@@ -18,8 +18,8 @@ public BuildEventInfo(string name, string value)
18
18
}
19
19
20
20
// SendKeys requires brackets around certain characters which have meaning
21
- public string SendKeysName { get { return "${(}" + Name + "{)}" ; } }
22
- public string FormattedName { get { return "$(" + Name + ")" ; } }
21
+ public string SendKeysName { get { return "${(}" + Name + "{)}" ; } }
22
+ public string FormattedName { get { return "$(" + Name + ")" ; } }
23
23
}
24
24
25
25
public class BuildEventVars
@@ -70,36 +70,43 @@ public string BaseDir
70
70
{
71
71
get
72
72
{
73
- Uri uri = new Uri ( Assembly . GetEntryAssembly ( ) . GetName ( ) . CodeBase ) ;
74
- // special behavior if we're running in flashdevelop.exe
75
- if ( Path . GetFileName ( uri . LocalPath ) . ToLower ( ) == DistroConfig . DISTRIBUTION_NAME . ToLower ( ) + ".exe" )
73
+ string localPath = new Uri ( Assembly . GetEntryAssembly ( ) . GetName ( ) . CodeBase ) . LocalPath ;
74
+ string entry = Path . GetFileName ( localPath ) ;
75
+ string flashdevelop = DistroConfig . DISTRIBUTION_NAME + ".exe" ;
76
+
77
+ string appDir = Path . GetDirectoryName ( localPath ) ;
78
+ if ( ! entry . Equals ( flashdevelop , StringComparison . OrdinalIgnoreCase ) )
76
79
{
77
- string local = Path . Combine ( Path . GetDirectoryName ( uri . LocalPath ) , ".local" ) ;
78
- if ( ! File . Exists ( local ) )
79
- {
80
- String appDir = Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) ;
81
- return Path . Combine ( appDir , DistroConfig . DISTRIBUTION_NAME ) ;
82
- }
83
- else return Path . GetDirectoryName ( uri . LocalPath ) ;
80
+ // assume we're running in fdbuild.exe - appDir is fdbuildDir
81
+ string toolsDir = Path . GetDirectoryName ( appDir ) ;
82
+ appDir = Path . GetDirectoryName ( toolsDir ) ;
84
83
}
85
- else return string . Empty ;
84
+
85
+ string local = Path . Combine ( appDir , ".local" ) ;
86
+ if ( File . Exists ( local ) ) return appDir ;
87
+
88
+ string localAppData = Environment . GetFolderPath ( Environment . SpecialFolder . LocalApplicationData ) ;
89
+ return Path . Combine ( localAppData , DistroConfig . DISTRIBUTION_NAME ) ;
86
90
}
87
91
}
88
92
89
93
public string FDBuild
90
94
{
91
95
get
92
96
{
93
- Uri uri = new Uri ( Assembly . GetEntryAssembly ( ) . GetName ( ) . CodeBase ) ;
97
+ string localPath = new Uri ( Assembly . GetEntryAssembly ( ) . GetName ( ) . CodeBase ) . LocalPath ;
98
+ string entry = Path . GetFileName ( localPath ) ;
99
+ string flashdevelop = DistroConfig . DISTRIBUTION_NAME + ".exe" ;
100
+
94
101
// special behavior if we're running in flashdevelop.exe
95
- if ( Path . GetFileName ( uri . LocalPath ) . ToLower ( ) == DistroConfig . DISTRIBUTION_NAME . ToLower ( ) + ".exe" )
102
+ if ( entry . Equals ( flashdevelop , StringComparison . OrdinalIgnoreCase ) )
96
103
{
97
- string startupDir = Path . GetDirectoryName ( uri . LocalPath ) ;
98
- string toolsDir = Path . Combine ( startupDir , "Tools" ) ;
104
+ string appDir = Path . GetDirectoryName ( localPath ) ;
105
+ string toolsDir = Path . Combine ( appDir , "Tools" ) ;
99
106
string fdbuildDir = Path . Combine ( toolsDir , "fdbuild" ) ;
100
107
return Path . Combine ( fdbuildDir , "fdbuild.exe" ) ;
101
108
}
102
- else return uri . LocalPath ;
109
+ else return localPath ;
103
110
}
104
111
}
105
112
0 commit comments