Skip to content

Commit

Permalink
File-separator fixes voor Linux vs Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tcdewit committed Feb 19, 2014
1 parent 3481e86 commit 665ece3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions WAD_Collector/src/wad/db/ReadFromPacsDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package wad.db;

import java.io.File;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.ResultSet;
Expand Down Expand Up @@ -57,12 +58,12 @@ public static ArrayList<String> getFileListFromSerie(Connection dbConnection, St

//files identiefier bekend, nu filepath uitlezen en uit filesystem dirpath uitlezen
filepath = rs_files.getString("filepath");
filepath = filepath.replace('/', '\\');
filepath = filepath.replace("/", File.separator);
stmt_filesystem = dbConnection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rs_filesystem = stmt_filesystem.executeQuery("SELECT dirpath FROM filesystem WHERE pk='"+filesystem_fk+"'");
while (rs_filesystem.next()){
dirpath = rs_filesystem.getString("dirpath");
profileList.add(dirpath+"\\"+filepath);
profileList.add(dirpath+File.separator+filepath);
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions WAD_Selector/nbproject/private/private.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
compile.on.save=true
do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
user.properties.file=C:\\Documents and Settings\\tcdewit\\Application Data\\NetBeans\\7.2.1\\build.properties
work.dir=dist
9 changes: 5 additions & 4 deletions WAD_Selector/src/wad/db/GetPatientFromIqcDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/
package wad.db;

import java.io.File;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
Expand Down Expand Up @@ -171,7 +172,7 @@ private void setInstance(Connection dbConnection, String instanceFk, int serieNo
while (rs_files.next()){
String filessystemFk = rs_files.getString("filesystem_fk");
filepath = rs_files.getString("filepath");
filepath = filepath.replace('/', '\\');
filepath = filepath.replace("/", File.separator);
Statement stmt_filesystem = dbConnection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rs_filesystem = stmt_filesystem.executeQuery("SELECT * FROM filesystem WHERE pk='"+filessystemFk+"'");
while (rs_filesystem.next()){
Expand All @@ -181,18 +182,18 @@ private void setInstance(Connection dbConnection, String instanceFk, int serieNo
stmt_filesystem.close();
}
String archivePath = ReadConfigXML.readFileElement("archive");
archivePath = archivePath.replace('/', '\\');
archivePath = archivePath.replace("/", File.separator);
// VUmc - JK - 20121203 - allow multiple archive locations
// If database table filesystem column dirpath starts with '/', '\' or has ':' as 2nd character
// then we assume the dirpath is absolute and we don't need to add the archivePath. However,
// if no archive location is configured in DCM4CHEE, dirpath is relative and starting from
// the archive path, so it needs to be added in that case.
if ( (dirpath.indexOf("/") == 0) || (dirpath.indexOf("\\") == 0) || (dirpath.indexOf(":") == 1) ) {
// assume this is an absolute path
instance.setFilename(dirpath+"\\"+filepath);
instance.setFilename(dirpath+File.separator+filepath);
} else {
// assume this is a relative path and need to add configured archivePath in front
instance.setFilename(archivePath+dirpath+"\\"+filepath);
instance.setFilename(archivePath+dirpath+File.separator+filepath);
}
// End VUmc - JK - 20121203
rs_files.close();
Expand Down

0 comments on commit 665ece3

Please sign in to comment.