@@ -65,18 +65,19 @@ private void DetectFlexSdk(string flexsdkPath)
6565 flexsdkPath = Path . GetDirectoryName ( flexsdkPath ) ;
6666
6767 sdkPath = flexsdkPath ;
68- mxmlcPath = Path . Combine ( Path . Combine ( flexsdkPath , "lib" ) , "mxmlc.jar" ) ;
69- fcshPath = Path . Combine ( Path . Combine ( flexsdkPath , "lib" ) , "fcsh.jar" ) ;
70- asc2Path = Path . Combine ( Path . Combine ( flexsdkPath , "lib" ) , "mxmlc-cli.jar" ) ;
68+ string libPath = Path . Combine ( flexsdkPath , "lib" ) ;
69+ mxmlcPath = Path . Combine ( libPath , "mxmlc.jar" ) ;
70+ fcshPath = Path . Combine ( libPath , "fcsh.jar" ) ;
71+ asc2Path = Path . Combine ( libPath , "mxmlc-cli.jar" ) ;
7172 if ( ! File . Exists ( asc2Path ) ) ascshPath = null ;
7273 else
7374 {
74- ascshPath = Path . Combine ( Path . Combine ( flexsdkPath , "lib" ) , "ascsh.jar" ) ;
75- if ( ! File . Exists ( ascshPath ) && ! File . Exists ( ascshPath + ".disabled" ) )
75+ ascshPath = Path . Combine ( libPath , "ascsh.jar" ) ;
76+ string toolsDir = Path . GetDirectoryName ( FDBuildDirectory ) ;
77+ string lib = Path . Combine ( toolsDir , "flexlibs/lib/ascsh.jar" ) ;
78+ if ( ShouldCopyASCSH ( lib , ascshPath ) )
7679 {
7780 // try copying the missing JAR in the SDK
78- string toolsDir = Path . GetDirectoryName ( FDBuildDirectory ) ;
79- string lib = Path . Combine ( toolsDir , "flexlibs/lib/ascsh.jar" ) ;
8081 try
8182 {
8283 File . Copy ( lib , ascshPath ) ;
@@ -94,6 +95,26 @@ private void DetectFlexSdk(string flexsdkPath)
9495 VMARGS = jvmConfig [ "java.args" ] ;
9596 }
9697
98+ private bool ShouldCopyASCSH ( string lib , string ascsh )
99+ {
100+ if ( File . Exists ( ascsh + ".disabled" ) ) return false ;
101+ if ( ! File . Exists ( ascsh ) ) return true ;
102+ // should the JAR be upgraded?
103+ FileInfo infoFrom = new FileInfo ( lib ) ;
104+ FileInfo infoTo = new FileInfo ( ascsh ) ;
105+ if ( infoFrom . LastWriteTime > infoTo . LastWriteTime )
106+ {
107+ try
108+ {
109+ Console . WriteLine ( "Found 'ascsh.jar' but it looks obsolete." ) ;
110+ File . Delete ( ascsh ) ;
111+ return true ;
112+ }
113+ catch { }
114+ }
115+ return false ;
116+ }
117+
97118 private string ResolveFlexSdk ( string flexsdkPath )
98119 {
99120 if ( flexsdkPath != null )
0 commit comments