Giving command line arguments to java program over git-bash -
i'm working on program zip , unzip files/directories , behaves kind of weird when call on git bash.
the program takes 3 arguments (zip/unzip, inputpath, outputpath). example:
java -jar zip_unzip.jar --zip h:\\zip_test h:\\test5\zip_test_4.zip
everything works fine when call on eclipse or cmd. creates directory structure if doesn't exist , zips input folder newly created output folder. when call on git bash in example above somehow "ignores" backslash , instead of creating folder called test5\
, creates zip-archive called test5zip_test_4.zip
here's snippet of code takes care of creating directory structure, zippedfolder outputpath-parameter:
file directorytozip = new file(inputfolder); string targetzippedfolder = zippedfolder; targetzippedfolder = targetzippedfolder.replace("\\", "/"); //create directory store archive in, if doesn't exist file destdir = new file(targetzippedfolder.substring(0, targetzippedfolder.lastindexof("/"))); if (!destdir.exists()) { destdir.mkdirs(); }
in line 3 of codesnippet i'm replacing every backslash forwardslash because thought make platform-independent.
can explain behavior of git bash me , maybe suggest more platform-independent path handling method?
Comments
Post a Comment