From 665ece304acafcfe030c506be70c8ccc9ea796fd Mon Sep 17 00:00:00 2001 From: Tim de Wit Date: Wed, 19 Feb 2014 11:39:09 +0100 Subject: [PATCH] File-separator fixes voor Linux vs Windows --- WAD_Collector/src/wad/db/ReadFromPacsDatabase.java | 5 +++-- WAD_Selector/nbproject/private/private.properties | 5 +++++ WAD_Selector/src/wad/db/GetPatientFromIqcDatabase.java | 9 +++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/WAD_Collector/src/wad/db/ReadFromPacsDatabase.java b/WAD_Collector/src/wad/db/ReadFromPacsDatabase.java index 9b4d566..ec9006d 100644 --- a/WAD_Collector/src/wad/db/ReadFromPacsDatabase.java +++ b/WAD_Collector/src/wad/db/ReadFromPacsDatabase.java @@ -4,6 +4,7 @@ */ package wad.db; +import java.io.File; import java.sql.Statement; import java.sql.Connection; import java.sql.ResultSet; @@ -57,12 +58,12 @@ public static ArrayList 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); } } } diff --git a/WAD_Selector/nbproject/private/private.properties b/WAD_Selector/nbproject/private/private.properties index f8b630f..0583224 100644 --- a/WAD_Selector/nbproject/private/private.properties +++ b/WAD_Selector/nbproject/private/private.properties @@ -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 diff --git a/WAD_Selector/src/wad/db/GetPatientFromIqcDatabase.java b/WAD_Selector/src/wad/db/GetPatientFromIqcDatabase.java index cb523e3..506089c 100644 --- a/WAD_Selector/src/wad/db/GetPatientFromIqcDatabase.java +++ b/WAD_Selector/src/wad/db/GetPatientFromIqcDatabase.java @@ -4,6 +4,7 @@ */ package wad.db; +import java.io.File; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; @@ -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()){ @@ -181,7 +182,7 @@ 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, @@ -189,10 +190,10 @@ private void setInstance(Connection dbConnection, String instanceFk, int serieNo // 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();