Skip to content

Commit

Permalink
MPL-102 Fixed issue with path processing when running server on Win (#…
Browse files Browse the repository at this point in the history
…103)

This fix is for rare case of running Jenkins server on windows. The tokenization is not the great way of processing and expecting proper array items on the output was quite silly. So I rewrote the function to use File mechanism of parsing the paths - on *nix it will properly work with *nix paths and on windows it will properly process the windows paths.
  • Loading branch information
sparshev authored Oct 19, 2022
1 parent 37ce623 commit 54365fd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/com/griddynamics/devops/mpl/Helper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ abstract class Helper {
*/
@NonCPS
static String pathToSimpleName(String path) {
return path.tokenize('./')[-3,-2].join('/')
def p = new File(path)
def fname = p.getName().toString()
if( p.getParentFile() ) {
return [p.getParentFile().getName(), fname.take(fname.lastIndexOf('.'))].join('/')
}
return fname.take(fname.lastIndexOf('.'))
}

/**
Expand Down

0 comments on commit 54365fd

Please sign in to comment.