-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5: aligned packages, fixed env cmd, solved duplicate context issue, …
…fixed bugs
- Loading branch information
Showing
94 changed files
with
475 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nfw/tools/ide/common/OperatingSystem.java → ...devonfw/tools/ide/os/OperatingSystem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../tools/ide/common/SystemArchitecture.java → ...onfw/tools/ide/os/SystemArchitecture.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../devonfw/tools/ide/common/SystemInfo.java → .../com/devonfw/tools/ide/os/SystemInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...onfw/tools/ide/common/SystemInfoImpl.java → .../devonfw/tools/ide/os/SystemInfoImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.devonfw.tools.ide.common; | ||
package com.devonfw.tools.ide.os; | ||
|
||
import java.util.Locale; | ||
|
||
|
98 changes: 98 additions & 0 deletions
98
cli/src/main/java/com/devonfw/tools/ide/os/WindowsPathSyntax.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package com.devonfw.tools.ide.os; | ||
|
||
import java.util.Locale; | ||
import java.util.Objects; | ||
|
||
/** | ||
* TODO hohwille This type ... | ||
* | ||
*/ | ||
public enum WindowsPathSyntax { | ||
|
||
/** Windows path like "C:\..." or "D:\...". */ | ||
WINDOWS, | ||
|
||
/** MSys (git-bash) path like "/c/..." or "/d/...". */ | ||
MSYS; | ||
|
||
/** | ||
* @param path the potential path. May be any {@link String}. | ||
* @return the the drive letter (e.g. "C" or "D") or {@code null} if the given {@link String} is not a path in this | ||
* {@link WindowsPathSyntax}. | ||
*/ | ||
public String getDrive(String path) { | ||
|
||
if ((path != null) && (path.length() >= 3)) { | ||
char c0 = path.charAt(0); | ||
char c1 = path.charAt(1); | ||
char c2 = path.charAt(2); | ||
switch (this) { | ||
case WINDOWS: // 'C:\' | ||
if ((c1 == ':') && (c2 == '\\') && (c0 >= 'A') && (c0 <= 'Z')) { | ||
return Character.toString(c0); | ||
} | ||
break; | ||
case MSYS: // '/c/' | ||
if ((c0 == '/') && (c2 == '/') && isLowerLatinLetter(c1)) { | ||
return Character.toString(c1); | ||
} | ||
break; | ||
default: | ||
throw new IllegalArgumentException(toString()); | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
private static boolean isLowerLatinLetter(char c) { | ||
|
||
return (c >= 'a') && (c <= 'z'); | ||
} | ||
|
||
/** | ||
* @param path the path where to replace the drive letter. | ||
* @param drive the new {@link #getDrive(String) drive letter}. | ||
* @return the new path pointing to the given {@code drive} in this {@link WindowsPathSyntax}. | ||
*/ | ||
public String replaceDrive(String path, String drive) { | ||
|
||
Objects.requireNonNull(path); | ||
Objects.requireNonNull(drive); | ||
if (path.length() < 3) { | ||
throw new IllegalArgumentException(path); | ||
} | ||
String restPath = path.substring(3); | ||
switch (this) { | ||
case WINDOWS: | ||
restPath = restPath.replace('/', '\\'); | ||
break; | ||
case MSYS: | ||
restPath = restPath.replace('\\', '/'); | ||
break; | ||
default: | ||
throw new IllegalStateException(toString()); | ||
} | ||
return getRootPath(drive) + restPath; | ||
} | ||
|
||
/** | ||
* @param drive the drive letter (e.g. "C" or "D"). | ||
* @return the root path for the given {@code drive} (e.g. "C:\\" or "/c/"). | ||
*/ | ||
public String getRootPath(String drive) { | ||
|
||
Objects.requireNonNull(drive); | ||
if ((drive.length() != 1) || !isLowerLatinLetter(Character.toLowerCase(drive.charAt(0)))) { | ||
throw new IllegalArgumentException(drive); | ||
} | ||
switch (this) { | ||
case WINDOWS: | ||
return drive.toUpperCase(Locale.ROOT) + ":\\"; | ||
case MSYS: | ||
return "/" + drive.toLowerCase(Locale.ROOT) + "/"; | ||
default: | ||
throw new IllegalStateException(toString()); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
cli/src/main/java/com/devonfw/tools/ide/repo/DefaultToolRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ter/androidstudio/AndroidJsonContent.java → ...ool/androidstudio/AndroidJsonContent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...er/androidstudio/AndroidJsonDownload.java → ...ol/androidstudio/AndroidJsonDownload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...pdater/androidstudio/AndroidJsonItem.java → ...e/tool/androidstudio/AndroidJsonItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.