@@ -122,7 +122,7 @@ public static void deleteExtractionDirectory() throws IOException {
122
122
/** Returns the directory used for storing the extracted libraries, binaries and JARs */
123
123
public static Path getExtractionDirectory () throws IOException {
124
124
if (extractionDir == null ) {
125
- extractionDir = Paths .get (getApplicationsDir (), "me.bechberger.ap-loader" , getVersion ());
125
+ extractionDir = getApplicationsDir (). resolve ( Paths .get ("me.bechberger.ap-loader" , getVersion () ));
126
126
if (Files .notExists (extractionDir )) {
127
127
Files .createDirectories (extractionDir );
128
128
}
@@ -133,16 +133,16 @@ public static Path getExtractionDirectory() throws IOException {
133
133
/**
134
134
* Returns directory where applications places their files. Specific to operating system
135
135
*/
136
- private static String getApplicationsDir () {
136
+ private static Path getApplicationsDir () {
137
137
String os = System .getProperty ("os.name" ).toLowerCase ();
138
- if (os .contains ("linux" )) {
138
+ if (os .startsWith ("linux" )) {
139
139
String xdgDataHome = System .getenv ("XDG_DATA_HOME" );
140
140
if (xdgDataHome != null && !xdgDataHome .isEmpty ()) {
141
- return xdgDataHome ;
141
+ return Paths . get ( xdgDataHome ) ;
142
142
}
143
- return Paths .get (System .getProperty ("user.home" ), ".local" , "share" ). toString () ;
144
- } else if (os .contains ( " mac" )) {
145
- return Paths .get (System .getProperty ("user.home" ), "Library" , "Application Support" ). toString () ;
143
+ return Paths .get (System .getProperty ("user.home" ), ".local" , "share" );
144
+ } else if (os .startsWith ( "macosx" ) || os . startsWith ( " mac os x " )) {
145
+ return Paths .get (System .getProperty ("user.home" ), "Library" , "Application Support" );
146
146
}
147
147
throw new UnsupportedOperationException ("Unsupported os " + os );
148
148
}
0 commit comments