Skip to content

Commit 731b0cc

Browse files
committed
Small updates to BuildEventVars
Added support for $(UserAppDir). Fixed $(FDBuild) and $(ToolsDir) showing wrong values in Project Properties dialog.
1 parent f0ba0d4 commit 731b0cc

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

External/Plugins/ProjectManager/Projects/BuildEventVars.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public BuildEventInfo[] GetVars()
4444
infos.Add(new BuildEventInfo("FDBuild", FDBuild));
4545
infos.Add(new BuildEventInfo("ToolsDir", ToolsDir));
4646
infos.Add(new BuildEventInfo("TimeStamp", DateTime.Now.ToString("g")));
47+
infos.Add(new BuildEventInfo("UserAppDir", UserAppDir));
4748
if (project != null)
4849
{
4950
infos.Add(new BuildEventInfo("OutputFile", project.OutputPath));
@@ -73,23 +74,33 @@ public string FDBuild
7374
{
7475
string url = Assembly.GetEntryAssembly().GetName().CodeBase;
7576
Uri uri = new Uri(url);
76-
77+
7778
// special behavior if we're running in flashdevelop.exe
7879
if (Path.GetFileName(uri.LocalPath).ToLower() == DistroConfig.DISTRIBUTION_NAME.ToLower() + ".exe")
7980
{
8081
string startupDir = Path.GetDirectoryName(uri.LocalPath);
81-
string local = Path.Combine(Path.GetDirectoryName(uri.LocalPath), ".local");
82-
if (!File.Exists(local))
83-
{
84-
String appDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
85-
startupDir = Path.Combine(appDir, DistroConfig.DISTRIBUTION_NAME);
86-
}
82+
//NOTE: FDBuild does not exist in AppData\Local\FlashDevelop; code commented out in case of reuse
83+
//string local = Path.Combine(Path.GetDirectoryName(uri.LocalPath), ".local");
84+
//if (!File.Exists(local))
85+
//{
86+
// String appDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
87+
// startupDir = Path.Combine(appDir, DistroConfig.DISTRIBUTION_NAME);
88+
//}
8789
string toolsDir = Path.Combine(startupDir, "Tools");
8890
string fdbuildDir = Path.Combine(toolsDir, "fdbuild");
8991
return Path.Combine(fdbuildDir, "fdbuild.exe");
9092
}
9193
else return uri.LocalPath;
9294
}
9395
}
96+
97+
public string UserAppDir
98+
{
99+
get
100+
{
101+
string localAppData = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
102+
return Path.Combine(localAppData, DistroConfig.DISTRIBUTION_NAME);
103+
}
104+
}
94105
}
95106
}

0 commit comments

Comments
 (0)