OKW_FileHelper { public static String convertDirectorySeperator( String fpsPath ) { String lvsReturn = fpsPath; Log.LogFunctionStartDebug( "OKW_FileHelper.ConvertDirectorySeperator", "fpsPath", fpsPath ); try { String myFileSeparator = System.getProperty( "file.separator" ); if ( "/".equals( myFileSeparator ) ) { lvsReturn = fpsPath.replace( "\\", "/" ); } else if ( "\\".equals( myFileSeparator ) ) { lvsReturn = fpsPath.replace( "/", "\\" ); } else throw ( new OKWDirectorySeperatorNotImplementedException( "Error: Unknown file.separator: -" + myFileSeparator + "-" ) ); lvsReturn = lvsReturn.replace( "\\C:", "C:" ); } finally { Log.LogFunctionEndDebug( lvsReturn ); } return lvsReturn; }  static Boolean createEmptyDirectory( String fpsPath ); static void deleteDirectory( String Path ); static Boolean directoryExists( String fpsPaFiNa ); static void copyDirectory( String fpsSourceFolder, String fpsDestinationFolder ); static boolean moveDirectory( String fpsPaNaSource, String fpsPaNaDestination ); static void copy( String fpsSource, String fpsDestination, Boolean copySubDirs ); static ArrayList<File> ListFiles( String fpsPath ); static void deleteFiles( String fpsPaFiNa ); static Boolean deleteFile( String fpsPaFiNa ); static Boolean fileExists( String fpsPaFiNa ); static Boolean isFile( String PATH ); static void move( String fpsPaFiNaSource, String fpsPaFiNaDestination ); static boolean createFile( String fpsPaFiNa ); static Boolean isDirectoryEmpty( String PATH ); static String convertDirectorySeperator( String fpsPath ); static void DirectoryCreate( String PATH );  }
@Test public void tcDosPath2UnixPath() { String lsDosPath = "\\abc\\abc\\file.ext"; String lsUnixPath = "/abc/abc/file.ext"; String CurrentFileSeparator = System.getProperty( "file.separator" ); if ( "\\".equals( CurrentFileSeparator ) ) assertEquals( lsDosPath, OKW_FileHelper.convertDirectorySeperator( lsUnixPath ) ); else if ( "/".equals( CurrentFileSeparator ) ) assertEquals( lsUnixPath, OKW_FileHelper.convertDirectorySeperator( lsDosPath ) ); else fail( "DirectorySearatorChar ist weder UNIX noc DOS typisch: " + CurrentFileSeparator ); }