This repository was archived by the owner on Nov 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-8
lines changed
src/main/java/org/suren/autotest/web/framework/autoit3 Expand file tree Collapse file tree 1 file changed +23
-8
lines changed Original file line number Diff line number Diff line change 2121import java .io .InputStream ;
2222import java .net .URL ;
2323import java .net .URLDecoder ;
24+ import java .util .Enumeration ;
2425import java .util .Properties ;
2526
2627import org .slf4j .Logger ;
@@ -39,25 +40,39 @@ public class AutoItCmd
3940 private static final Logger logger = LoggerFactory .getLogger (AutoItCmd .class );
4041
4142 public static String autoitExe = null ;
42- private static final String AUTO_IT3_PATH = "autoit3.properties" ;
43- private static final String FILE_CHOOSE_SCRIPT = "file_choose.au3" ;
43+ public static final String AUTO_IT3_PATH = "autoit3.properties" ;
44+ public static final String FILE_CHOOSE_SCRIPT = "file_choose.au3" ;
45+
46+ public static final String PRO_PATH = "path" ;
4447
4548 private static Properties autoItPro = new Properties ();
4649
4750 private static boolean isRunning = false ;
4851
4952 static
5053 {
51- try ( InputStream input = AutoItCmd . class . getClassLoader (). getResourceAsStream ( AUTO_IT3_PATH ))
54+ try
5255 {
53- if (input == null )
56+ Enumeration <URL > resources = AutoItCmd .class .getClassLoader ().getResources (AUTO_IT3_PATH );
57+ if (resources != null )
58+ {
59+ while (resources .hasMoreElements ())
60+ {
61+ URL url = resources .nextElement ();
62+
63+ try (InputStream input = url .openStream ())
64+ {
65+
66+ autoItPro .load (input );
67+
68+ autoitExe = autoItPro .getProperty (PRO_PATH );
69+ }
70+ }
71+ }
72+ else
5473 {
5574 throw new RuntimeException ("Can not found " + AUTO_IT3_PATH + " in class path." );
5675 }
57-
58- autoItPro .load (input );
59-
60- autoitExe = autoItPro .getProperty ("path" );
6176 }
6277 catch (IOException e )
6378 {
You can’t perform that action at this time.
0 commit comments