> On Sep 13, 2024, at 7:46 AM, CARL Philippe (LBP) <[email protected]>
> wrote:
>
> Dear all (probably Wayne),
> the File.separator method is not working anymore under Windows when going
> from the update v1.54i16 to the v1.54j as illustrated with the following
> macro code:
Hi Philippe,
Window uses both “/“ and “\” as file path separators, so you have to check for
both. The easiest way to get the parent directory of a file is to use the
File.getDirectory(path) macro function.
Dialog.create("Window for testing");
Dialog.addFile("Please select a file", "");
Dialog.show();
filePathFull = Dialog.getString();
filePath = File.getDirectory(filePathFull);
print(filePathFull);
print(filePath);
> Dialog.create("Window for testing");
> Dialog.addFile("Please select a file","");
> Dialog.show();
> filePathFull = Dialog.getString();
> filePath = filePathFull.substring(0, lastIndexOf(filePathFull,
> File.separator) + 1);
> print(filePathFull);
> print(filePath);
> for which the second line will be empty after the update v1.54j.
> Do not hesitate in the case you need additionnal information about my used OS
> or configuration.
> My best regards,
> Philippe
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html