diff options
Diffstat (limited to 'qadevOOo/runner/graphical/FileHelper.java')
-rw-r--r-- | qadevOOo/runner/graphical/FileHelper.java | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/qadevOOo/runner/graphical/FileHelper.java b/qadevOOo/runner/graphical/FileHelper.java index 892f652567c1..9599e6190c1a 100644 --- a/qadevOOo/runner/graphical/FileHelper.java +++ b/qadevOOo/runner/graphical/FileHelper.java @@ -1,7 +1,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -49,13 +49,13 @@ public class FileHelper String sOSName = System.getProperty("os.name"); String sOSArch = System.getProperty("os.arch"); String sOSVersion = System.getProperty("os.version"); - + GlobalLogWriter.println(sOSName); GlobalLogWriter.println(sOSArch); GlobalLogWriter.println(sOSVersion); } - + public static void MessageBox(String _sStr) { String sVersion = System.getProperty("java.version"); @@ -83,17 +83,17 @@ public class FileHelper // System.out.println( _sFile ); // System.out.println( aFile.getAbsolutePath() ); // MessageBox("Der JavaProzess wartet auf eine interaktion ihrerseits."); - // + // // File aFile2 = new File(_sFile); // if (aFile2.exists()) // { // System.out.println("Thanks, file exists." ); // return true; // } - // } + // } return false; } - + public static boolean isDir(String _sDir) { if (_sDir == null) @@ -115,7 +115,7 @@ public class FileHelper } return false; } - + public static String getBasename(String _sFilename) { if (_sFilename == null) @@ -149,7 +149,7 @@ public class FileHelper } return _sFilename; } - + public static String getSuffix(String _sFilename) { if (_sFilename == null) @@ -163,7 +163,7 @@ public class FileHelper } return ""; } - + public static String getPath(String _sFilename) { if (_sFilename == null) @@ -186,19 +186,19 @@ public class FileHelper /* static ArrayList files = new ArrayList(); - public static Object[] traverse( String afileDirectory ) + public static Object[] traverse( String afileDirectory ) { - + File fileDirectory = new File(afileDirectory); // Testing, if the file is a directory, and if so, it throws an exception if ( !fileDirectory.isDirectory() ) { throw new IllegalArgumentException( "not a directory: " + fileDirectory.getName() ); } - + // Getting all files and directories in the current directory File[] entries = fileDirectory.listFiles(); - + // Iterating for each file and directory for ( int i = 0; i < entries.length; ++i ) { @@ -237,7 +237,7 @@ public class FileHelper first = path.substring(0, n); path = path.substring(n + 1); } - + String already_done = null; StringTokenizer path_tokenizer = new StringTokenizer(path,fs,false); already_done = first; @@ -249,7 +249,7 @@ public class FileHelper // System.out.println(already_done); //create the directory new_dir.mkdirs(); - if (OSHelper.isUnix() && + if (OSHelper.isUnix() && _sMode.length() > 0) { try @@ -268,7 +268,7 @@ public class FileHelper public static void chmod(File file, String mode) throws java.io.IOException { Runtime.getRuntime().exec - (new String[] + (new String[] {"chmod", mode, file.getAbsolutePath()}); } @@ -305,7 +305,7 @@ public class FileHelper sSubDirs = sSubDirs.substring(1); } } - + return sSubDirs; } @@ -380,11 +380,11 @@ public class FileHelper } } - public static void copy(String _sSource, String _sDestination) + public static void copy(String _sSource, String _sDestination) { FileInputStream aFIS = null; FileOutputStream aFOS = null; - + try { aFIS = new FileInputStream(_sSource); @@ -416,11 +416,11 @@ public class FileHelper } catch (java.io.IOException e) { - System.out.println("Error: caught Exception: " + e.getMessage()); + System.out.println("Error: caught Exception: " + e.getMessage()); } } } - + // try // { // File inputFile = new File(_sSource); @@ -429,12 +429,12 @@ public class FileHelper // java.io.FileReader in = new java.io.FileReader(inputFile); // java.io.FileWriter out = new java.io.FileWriter(outputFile); // int c; -// +// // while ((c = in.read()) != -1) // { // out.write(c); // } -// +// // in.close(); // out.close(); // } @@ -445,12 +445,12 @@ public class FileHelper // } } - + /** * Within the directory run through, it's possible to say which file extension types should not * consider like '*.prn' because it's not a document. * - * @return a FileFilter function + * @return a FileFilter function */ public static FileFilter getFileFilter() { @@ -462,7 +462,7 @@ public class FileHelper if (pathname.getName().startsWith("~$")) { return false; - } + } // leave out files starts with '.~lock.' these are OpenOffice.org lock files if (pathname.getName().startsWith(".~lock.")) { @@ -490,7 +490,7 @@ public class FileHelper if (pathname.getName().endsWith("_")) { return false; - } + } return true; } }; @@ -500,7 +500,7 @@ public class FileHelper * Within the directory run through, it's possible to say which file extension types should not * consider like '*.prn' because it's not a document. * - * @return a FileFilter function + * @return a FileFilter function */ public static FileFilter getFileFilterPSorPDF() { @@ -511,7 +511,7 @@ public class FileHelper if (pathname.getName().endsWith(".ps")) { return true; - } + } if (pathname.getName().endsWith(".pdf")) { return true; @@ -525,7 +525,7 @@ public class FileHelper * Within the directory run through, it's possible to say which file extension types should not * consider like '*.prn' because it's not a document. * - * @return a FileFilter function + * @return a FileFilter function */ public static FileFilter getFileFilterJPEG() { @@ -536,7 +536,7 @@ public class FileHelper if (pathname.getName().toLowerCase().endsWith(".jpg")) { return true; - } + } if (pathname.getName().toLowerCase().endsWith(".jpeg")) { return true; @@ -550,7 +550,7 @@ public class FileHelper * Within the directory run through, it's possible to say which file extension types should not * consider like '*.ini' because it's not a document. * - * @return a FileFilter function + * @return a FileFilter function */ public static FileFilter getFileFilterINI() { @@ -567,7 +567,7 @@ public class FileHelper if (sPathname.endsWith(".ini")) { return true; - } + } return false; } }; @@ -595,7 +595,7 @@ public class FileHelper { createInfoFile(_sFile, _aGTA, ""); } - + public static void createInfoFile(String _sFile, ParameterHelper _aGTA, String _sSpecial) { String sFilename; @@ -616,7 +616,7 @@ public class FileHelper IniFile aIniFile = new IniFile(sIniFile); // OLD INFO FILE - + // String fs = System.getProperty("file.separator"); String ls = System.getProperty("line.separator"); String sInfoFilename = FileHelper.appendPath(sFileDir, sNameNoSuffix + ".info"); @@ -628,7 +628,7 @@ public class FileHelper { FileOutputStream out2 = new FileOutputStream(aInfoFile.toString()); PrintStream out = new PrintStream(out2); - + out.println("# automatically created file by graphical compare"); if (_aGTA != null) { @@ -645,7 +645,7 @@ public class FileHelper out.println("buildid=" + sBuildID); } aIniFile.insertValue("global", "buildid", sBuildID); - + // if (_sSpecial != null && _sSpecial.length() > 0) // { // out.write("special=" + _sSpecial + ls); @@ -667,7 +667,7 @@ public class FileHelper // out.write("# time is given in milli seconds" + ls); // out.write("time=" + nTime + ls); // } - + out.println(); out.println("# Values out of System.getProperty(...)"); out.println("os.name=" + System.getProperty("os.name")); @@ -685,7 +685,7 @@ public class FileHelper _aGTA.getPerformance().print(out); _aGTA.getPerformance().print(aIniFile, "global"); } - + out.flush(); out.close(); out2.close(); @@ -696,13 +696,13 @@ public class FileHelper e.printStackTrace(); } aIniFile.close(); - + // String sExtension = FileHelper.getSuffix(_aGTA.getInputFile()); // if (sExtension.startsWith(".")) // { // sExtension = sExtension.substring(1); // } -// +// // DB.writeToDB(_aGTA.getInputFile(), // sNameNoSuffix, // sExtension, @@ -711,7 +711,7 @@ public class FileHelper // _aGTA.getResolutionInDPI() // ); } - + public static void addBasenameToFile(String _sIndexFilename, String _sBasename, String _sCreator, String _sType, String _sSource) { // String sOutputDir = FileHelper.getPath(_sOutputFilename); @@ -762,6 +762,6 @@ public class FileHelper // String sBasename = FileHelper.getBasename(_sOutputFilename); addBasenameToFile(sIndexFilename, _sBasename, _sCreator, _sType, _sSource); } - + } |