Skip to content

Commit

Permalink
remove unixPath changes
Browse files Browse the repository at this point in the history
  • Loading branch information
katerina20 committed Jan 5, 2024
1 parent 1e585fc commit cd0a957
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
7 changes: 1 addition & 6 deletions src/main/java/com/crowdin/cli/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,7 @@ public static String buildUserAgent() {
}

public static String unixPath(String path) {
if (path == null) {
return null;
}
return isWindows()
? path.replaceAll("[\\\\/]+", "/")
: path.replaceAll("\\\\{2,}", "/").replaceAll("/+", "/");
return (path != null) ? path.replaceAll("\\{2,}", "/").replaceAll("/+", "/") : null;
}

public static String windowsPath(String path) {
Expand Down
13 changes: 2 additions & 11 deletions src/test/java/com/crowdin/cli/utils/UtilsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import java.util.Optional;
import org.apache.commons.lang3.SystemUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
Expand Down Expand Up @@ -38,15 +36,8 @@ public void testBuildUserAgent() {
}

@Test
@DisabledOnOs({OS.LINUX, OS.MAC})
public void testUnixPath_windows() {
assertEquals("/path/to/file", Utils.unixPath("\\path\\to\\\\file"));
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testUnixPath_unix() {
assertEquals("/path/to/file", Utils.unixPath("/path/to\\\\file"));
public void testUnixPath() {
assertEquals("/path/to/file", Utils.unixPath("\\path\\to\\file"));
}

@Test
Expand Down

0 comments on commit cd0a957

Please sign in to comment.