1
1
using System ;
2
- using System . Collections . Generic ;
3
2
using System . IO ;
3
+ using System . Collections . Generic ;
4
4
using System . Reflection ;
5
5
using PluginCore ;
6
6
@@ -40,7 +40,7 @@ public void AddVar(string name, string value)
40
40
public BuildEventInfo [ ] GetVars ( )
41
41
{
42
42
List < BuildEventInfo > infos = new List < BuildEventInfo > ( ) ;
43
-
43
+ infos . Add ( new BuildEventInfo ( "BaseDir" , BaseDir ) ) ;
44
44
infos . Add ( new BuildEventInfo ( "FDBuild" , FDBuild ) ) ;
45
45
infos . Add ( new BuildEventInfo ( "ToolsDir" , ToolsDir ) ) ;
46
46
infos . Add ( new BuildEventInfo ( "TimeStamp" , DateTime . Now . ToString ( "g" ) ) ) ;
@@ -60,36 +60,49 @@ public BuildEventInfo[] GetVars()
60
60
if ( project . Language == "as3" ) infos . Add ( new BuildEventInfo ( "FlexSDK" , project . CurrentSDK ) ) ;
61
61
}
62
62
infos . AddRange ( additional ) ;
63
-
64
63
return infos . ToArray ( ) ;
65
64
}
66
65
67
66
public string FDBuildDir { get { return Path . GetDirectoryName ( FDBuild ) ; } }
68
67
public string ToolsDir { get { return Path . GetDirectoryName ( FDBuildDir ) ; } }
69
68
70
- public string FDBuild
69
+ public string BaseDir
71
70
{
72
71
get
73
72
{
74
- string url = Assembly . GetEntryAssembly ( ) . GetName ( ) . CodeBase ;
75
- Uri uri = new Uri ( url ) ;
76
-
73
+ Uri uri = new Uri ( Assembly . GetEntryAssembly ( ) . GetName ( ) . CodeBase ) ;
77
74
// special behavior if we're running in flashdevelop.exe
78
75
if ( Path . GetFileName ( uri . LocalPath ) . ToLower ( ) == DistroConfig . DISTRIBUTION_NAME . ToLower ( ) + ".exe" )
79
76
{
80
- string startupDir = Path . GetDirectoryName ( uri . LocalPath ) ;
81
77
string local = Path . Combine ( Path . GetDirectoryName ( uri . LocalPath ) , ".local" ) ;
82
78
if ( ! File . Exists ( local ) )
83
79
{
84
80
String appDir = Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) ;
85
- startupDir = Path . Combine ( appDir , DistroConfig . DISTRIBUTION_NAME ) ;
81
+ return Path . Combine ( appDir , DistroConfig . DISTRIBUTION_NAME ) ;
86
82
}
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 ) ;
87
98
string toolsDir = Path . Combine ( startupDir , "Tools" ) ;
88
99
string fdbuildDir = Path . Combine ( toolsDir , "fdbuild" ) ;
89
100
return Path . Combine ( fdbuildDir , "fdbuild.exe" ) ;
90
101
}
91
102
else return uri . LocalPath ;
92
103
}
93
104
}
105
+
94
106
}
107
+
95
108
}
0 commit comments