Login  Register

IJ.getDirectory() OS differences

Posted by Ben.BigHair on Jun 13, 2007; 2:15pm
URL: http://imagej.273.s1.nabble.com/IJ-getDirectory-OS-differences-tp3699130.html

Hello,

It appears that the method IJ.getDirectory() returns "extra" path  
divider to the result on Windows but not on MacOSX.   Below is a  
simple plugin that shows the difference, and results from runs on  
Windows and MacOSX. I don't know Windows well enough to know if this  
is really a feature instead of a bug.  In the news log there is a  
reference to macro command getDirectory() ...

 > v1.34l, 15 April 2005
 > Fixed a bug in the getDirectory() macro function that resulted in  
double back slashes with root directories on Windows


Thanks!
Ben


// ImageJ version = 1.38t
// MacOSX...
// startup = /Applications/ImageJ/
// plugins = /Applications/ImageJ/plugins/
// macros = /Applications/ImageJ/macros/

// ImageJ version = 1.37t
// Windows...
// startup = C:\code\ImageJ\\
// plugins = C:\code\ImageJ\\plugins\
// macros = C:\code\ImageJ\\macros\


//  BEGIN
import ij.*;
import ij.plugin.PlugIn;

public class Path_Tester implements PlugIn {
   public void run( String arg){

     IJ.log("ImageJ version = " + IJ.getVersion());
     if (IJ.isLinux()==true) {IJ.log("Linux...");}
     if (IJ.isWindows()==true) {IJ.log("Windows...");}
     if (IJ.isMacOSX()==true) {IJ.log("MacOSX...");}


     IJ.log("startup = " + IJ.getDirectory("startup"));
     IJ.log("plugins = " + IJ.getDirectory("plugins"));
     IJ.log("macros = " + IJ.getDirectory("macros"));
     return;

     }
}
//
// END