I am using the latest version of ImageJ 1.51j with Java 1.6.24 on Windows 7 64-bit, and am having this issue:
ImageJ seems a bit confused about the forward and backslash syntax of files. In general one would expect it to accept both forward and double backward slashes and combinations of those. Mixing forward and double backslashes generally works as expected in ImageJ, EXCEPT when all slashes are forward. To illustrate the problem: This works: open("C:\\Users\\Engineer\\Macro Open File Test.tif"); And this works: open("C:\\Users\\Engineer/Macro Open File Test.tif"); And this also works: open("C:\\Users/Engineer/Macro Open File Test.tif"); But this does not work: open("C:/Users/Engineer/Macro Open File Test.tif"); Equivalently, This works: runMacro("C:\\Users\\Engineer\\Macro Run File Test.ijm"); And this works: runMacro("C:\\Users\\Engineer/Macro Run File Test.ijm"); And this also works: runMacro("C:\\Users/Engineer/Macro Run File Test.ijm"); But this does not work: runMacro("C:/Users/Engineer/Macro Run File Test.ijm"); Is this a bug? Or a Java issue? I want to be able to the all forward slash syntax, as ImageJ in my workflow would called by an external application (using the -exec command line option) which only uses forward slashes. Also note: When saving files, this problem does not occur. All these three syntaxes work as expected: saveAs("Tiff", "C:\\Users\\Engineer\\Macro Save File Test.tif"); saveAs("Tiff", "C:\\Users/Engineer/Macro Save File Test.tif"); saveAs("Tiff", "C:/Users/Engineer/Macro Save File Test.tif"); The windows API in general accepts both forward and backward slashes and combination of those, even if backslash is default. Stein -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Feb 16, 2017, at 5:42 AM, Stein Rørvik <[hidden email]> wrote:
> > I am using the latest version of ImageJ 1.51j with Java 1.6.24 on Windows 7 64-bit, and am having this issue: > > ImageJ seems a bit confused about the forward and backslash syntax of files. > In general one would expect it to accept both forward and double backward slashes and combinations of those. > > Mixing forward and double backslashes generally works as expected in ImageJ, EXCEPT when all slashes are forward. This bug is fixed in the latest ImageJ daily build (1.51k9). -wayne > To illustrate the problem: > > This works: > open("C:\\Users\\Engineer\\Macro Open File Test.tif"); > > And this works: > open("C:\\Users\\Engineer/Macro Open File Test.tif"); > > And this also works: > open("C:\\Users/Engineer/Macro Open File Test.tif"); > > But this does not work: > open("C:/Users/Engineer/Macro Open File Test.tif"); > > > Equivalently, > > This works: > runMacro("C:\\Users\\Engineer\\Macro Run File Test.ijm"); > > And this works: > runMacro("C:\\Users\\Engineer/Macro Run File Test.ijm"); > > And this also works: > runMacro("C:\\Users/Engineer/Macro Run File Test.ijm"); > > But this does not work: > runMacro("C:/Users/Engineer/Macro Run File Test.ijm"); > > > Is this a bug? Or a Java issue? > > I want to be able to the all forward slash syntax, as ImageJ in my workflow would called by an external > application (using the -exec command line option) which only uses forward slashes. > > Also note: When saving files, this problem does not occur. > All these three syntaxes work as expected: > > saveAs("Tiff", "C:\\Users\\Engineer\\Macro Save File Test.tif"); > saveAs("Tiff", "C:\\Users/Engineer/Macro Save File Test.tif"); > saveAs("Tiff", "C:/Users/Engineer/Macro Save File Test.tif"); > > The windows API in general accepts both forward and backward slashes and combination of those, even if backslash is default. > > Stein -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |