Skip to content

Commit ec35a2d

Browse files
committed
Fix AIRAC directory.
1 parent 7705b0a commit ec35a2d

5 files changed

Lines changed: 28 additions & 3 deletions

File tree

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The navigation data (all files in /QSimPlanner/[Version]/NavData folder)
1+
The navigation data (all files in /QSimPlanner/NavData folder)
22
shipped with this program is Aerosoft's property and is under Aerosoft's
33
NavDataPro license.
44

src/Installer/InstallerBuilder/AiracFile.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ private static void GetAirac()
2222
throw new NotImplementedException();
2323
}
2424
}
25-
25+
26+
/// <summary>
27+
/// Note: The consequence of this method means NavData is put into the
28+
/// same directory as QSimPlanner.exe. This is not where it's supposed
29+
/// to be, but it has to stay like this for compatibility with older
30+
/// version. When application starts, the NavData directory will be
31+
/// moved one level up.
32+
/// </summary>
2633
public static void CopyNavData()
2734
{
2835
GetAirac();

src/QSP/Common/Options/AppOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public AppOptions(
4545
}
4646

4747
public static AppOptions Default => new AppOptions(
48-
Path.GetFullPath("NavData"),
48+
Path.GetFullPath("../NavData"),
4949
true,
5050
true,
5151
true,

src/QSP/LibraryExtension/IOMethods.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.IO;
2+
using System.Linq;
23

34
namespace QSP.LibraryExtension
45
{
@@ -39,5 +40,10 @@ public static void CopyDirectory(DirectoryInfo source,
3940

4041
CopyFilesInDirectory(source, target, overwrite);
4142
}
43+
44+
public static bool IsDirectoryEmpty(string path)
45+
{
46+
return !Directory.EnumerateFileSystemEntries(path).Any();
47+
}
4248
}
4349
}

src/QSP/Program.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using CommonLibrary.LibraryExtension;
22
using QSP.Common.Options;
3+
using QSP.LibraryExtension;
34
using QSP.LibraryExtension.XmlSerialization;
45
using QSP.Properties;
56
using QSP.UI.Forms;
@@ -67,6 +68,7 @@ internal static void Main(string[] args)
6768
#endif
6869

6970
ShowLicenseIfNeeded();
71+
MoveNavData();
7072
var mainFrm = new QspForm();
7173
mainFrm.Init();
7274

@@ -215,6 +217,16 @@ private static void ReportError(string message)
215217
}
216218
}
217219

220+
// See notes in InstallerBuilder/AiracFile.cs, CopyNavData() method.
221+
private static void MoveNavData()
222+
{
223+
var dest = "../NavData";
224+
if (!Directory.Exists(dest) || IOMethods.IsDirectoryEmpty(dest))
225+
{
226+
Directory.Move("NavData", dest);
227+
}
228+
}
229+
218230
private static string GetGuid()
219231
{
220232
var attributes = typeof(Program).Assembly

0 commit comments

Comments
 (0)