Skip to content

Commit e0f460f

Browse files
committed
Added BaseDir to BuildEventVars and fixed FDBuild and ToolsDir paths... closes #968.
1 parent 8023cd3 commit e0f460f

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

External/Plugins/ProjectManager/Projects/BuildEventVars.cs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.IO;
3+
using System.Collections.Generic;
44
using System.Reflection;
55
using PluginCore;
66

@@ -40,7 +40,7 @@ public void AddVar(string name, string value)
4040
public BuildEventInfo[] GetVars()
4141
{
4242
List<BuildEventInfo> infos = new List<BuildEventInfo>();
43-
43+
infos.Add(new BuildEventInfo("BaseDir", BaseDir));
4444
infos.Add(new BuildEventInfo("FDBuild", FDBuild));
4545
infos.Add(new BuildEventInfo("ToolsDir", ToolsDir));
4646
infos.Add(new BuildEventInfo("TimeStamp", DateTime.Now.ToString("g")));
@@ -60,36 +60,49 @@ public BuildEventInfo[] GetVars()
6060
if (project.Language == "as3") infos.Add(new BuildEventInfo("FlexSDK", project.CurrentSDK));
6161
}
6262
infos.AddRange(additional);
63-
6463
return infos.ToArray();
6564
}
6665

6766
public string FDBuildDir { get { return Path.GetDirectoryName(FDBuild); } }
6867
public string ToolsDir { get { return Path.GetDirectoryName(FDBuildDir); } }
6968

70-
public string FDBuild
69+
public string BaseDir
7170
{
7271
get
7372
{
74-
string url = Assembly.GetEntryAssembly().GetName().CodeBase;
75-
Uri uri = new Uri(url);
76-
73+
Uri uri = new Uri(Assembly.GetEntryAssembly().GetName().CodeBase);
7774
// special behavior if we're running in flashdevelop.exe
7875
if (Path.GetFileName(uri.LocalPath).ToLower() == DistroConfig.DISTRIBUTION_NAME.ToLower() + ".exe")
7976
{
80-
string startupDir = Path.GetDirectoryName(uri.LocalPath);
8177
string local = Path.Combine(Path.GetDirectoryName(uri.LocalPath), ".local");
8278
if (!File.Exists(local))
8379
{
8480
String appDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
85-
startupDir = Path.Combine(appDir, DistroConfig.DISTRIBUTION_NAME);
81+
return Path.Combine(appDir, DistroConfig.DISTRIBUTION_NAME);
8682
}
83+
else return Path.GetDirectoryName(uri.LocalPath);
84+
}
85+
else return string.Empty;
86+
}
87+
}
88+
89+
public string FDBuild
90+
{
91+
get
92+
{
93+
Uri uri = new Uri(Assembly.GetEntryAssembly().GetName().CodeBase);
94+
// special behavior if we're running in flashdevelop.exe
95+
if (Path.GetFileName(uri.LocalPath).ToLower() == DistroConfig.DISTRIBUTION_NAME.ToLower() + ".exe")
96+
{
97+
string startupDir = Path.GetDirectoryName(uri.LocalPath);
8798
string toolsDir = Path.Combine(startupDir, "Tools");
8899
string fdbuildDir = Path.Combine(toolsDir, "fdbuild");
89100
return Path.Combine(fdbuildDir, "fdbuild.exe");
90101
}
91102
else return uri.LocalPath;
92103
}
93104
}
105+
94106
}
107+
95108
}

0 commit comments

Comments
 (0)