File tree Expand file tree Collapse file tree 1 file changed +24
-5
lines changed
tmc-plugin/src/fi/helsinki/cs/tmc/actions Expand file tree Collapse file tree 1 file changed +24
-5
lines changed Original file line number Diff line number Diff line change 10
10
import org .openide .modules .InstalledFileLocator ;
11
11
12
12
public class EnsureMavenBinaryIsExecutable {
13
-
13
+
14
14
private final static Path RELATIVE_MAVEN_LOCATION = Paths .get ("java" ).resolve ("maven" ).resolve ("bin" ).resolve ("mvn" );
15
-
15
+
16
16
private Path mavenPath ;
17
17
private final boolean isUnix ;
18
-
18
+
19
19
public EnsureMavenBinaryIsExecutable () {
20
20
this .isUnix = !System .getProperty ("os.name" ).startsWith ("Windows" );
21
21
}
22
-
22
+
23
23
public void run () {
24
24
if (!isUnix ) {
25
25
return ;
@@ -37,6 +37,10 @@ public void run() {
37
37
return ;
38
38
}
39
39
tryToChmod (mavenPath );
40
+
41
+ Path mavenHome = getConfigDirectory ();
42
+ Path extractedMavenLocation = mavenHome .resolve ("apache-maven-3.5.4" );
43
+ tryToChmod (extractedMavenLocation .resolve ("bin" ).resolve ("mvn" ));
40
44
}
41
45
42
46
private void tryToChmod (Path path ) {
@@ -46,6 +50,21 @@ private void tryToChmod(Path path) {
46
50
permissions .add (PosixFilePermission .OWNER_EXECUTE );
47
51
Files .setPosixFilePermissions (path , permissions );
48
52
}
49
- } catch (IOException ex ) { }
53
+ } catch (IOException ex ) {
54
+ }
55
+ }
56
+
57
+ static Path getConfigDirectory () {
58
+ Path configPath ;
59
+
60
+ String configEnv = System .getenv ("XDG_CONFIG_HOME" );
61
+
62
+ if (configEnv != null && configEnv .length () > 0 ) {
63
+ configPath = Paths .get (configEnv );
64
+ } else {
65
+ configPath = Paths .get (System .getProperty ("user.home" )).resolve (".config" );
66
+ }
67
+
68
+ return configPath .resolve ("tmc" );
50
69
}
51
70
}
You can’t perform that action at this time.
0 commit comments