IJ.getDirectory() OS differences

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

IJ.getDirectory() OS differences

Ben.BigHair
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
Reply | Threaded
Open this post in threaded view
|

Re: IJ.getDirectory() OS differences

Wayne Rasband
ImageJ 1.38u will fix a bug on Windows that caused the getDirectory()
macro function, and the Prefs.getHomeDir(), Menus.getPlugInsPath() and
Menus.getMacrosPath() methods, to sometimes return paths containing
double separators.

-wayne

On Jun 13, 2007, at 9:15 AM, Ben Tupper wrote:

> 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
>