Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check if plugin called with valid file path string #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
/.classpath
/.project
/.settings/

# OS X #
.DS_Store
57 changes: 32 additions & 25 deletions src/main/java/sc/fiji/hdf5/HDF5_Reader_Vibez.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,31 +156,38 @@ public void run(String arg)
String name = "";
boolean tryAgain;
String openMSG = "Open HDF5...";
do {
tryAgain = false;
OpenDialog od;
if (directory.equals(""))
od = new OpenDialog(openMSG, "");
else
od = new OpenDialog(openMSG, directory, "");

directory = od.getDirectory();
name = od.getFileName();
if (name == null)
return;
if (name == "")
return;

File testFile = new File(directory + name);
if (!testFile.exists() || !testFile.canRead())
return;

if (testFile.isDirectory()) {
directory = directory + name;
tryAgain = true;
}
} while (tryAgain);


if (arg != null && arg.endsWith("hdf")){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lukebfunk,

.hdf is not the only valid extension for hdf5 files. The other options and .h5and .hdf5. Please update your code to reflect this.

File theFile = new File(arg);
directory = theFile.getParent();
if (!directory.endsWith("/")) directory += "/";
name = theFile.getName();
} else {
do {
tryAgain = false;
OpenDialog od;
if (directory.equals(""))
od = new OpenDialog(openMSG, "");
else
od = new OpenDialog(openMSG, directory, "");

directory = od.getDirectory();
name = od.getFileName();
if (name == null)
return;
if (name == "")
return;

File testFile = new File(directory + name);
if (!testFile.exists() || !testFile.canRead())
return;

if (testFile.isDirectory()) {
directory = directory + name;
tryAgain = true;
}
} while (tryAgain);
}

// Get All Dataset names
//
Expand Down