litesoft
Diff Revisions
823
vs
878
for /trunk/Java/core/Server/src/org/litesoft/util/Directories.java
|
@@ -7,6 +7,7 @@ |
7 |
7 |
|
import org.litesoft.core.typeutils.*; |
8 |
8 |
|
import org.litesoft.core.util.*; |
9 |
9 |
|
|
|
10 |
+ |
@SuppressWarnings("UnusedDeclaration") |
10 |
11 |
|
public class Directories |
11 |
12 |
|
{ |
12 |
13 |
|
public static String currentWorking() |
|
@@ -70,6 +71,17 @@ |
70 |
71 |
|
return null; |
71 |
72 |
|
} |
72 |
73 |
|
|
|
74 |
+ |
public static File assertDirectory( File pExpectedDir ) |
|
75 |
+ |
throws FileSystemException |
|
76 |
+ |
{ |
|
77 |
+ |
Objects.assertNotNull( "ExpectedDir", pExpectedDir ); |
|
78 |
+ |
if ( !pExpectedDir.isDirectory() ) |
|
79 |
+ |
{ |
|
80 |
+ |
throw new FileSystemException( "Not a Directory: " + pExpectedDir.getAbsolutePath() ); |
|
81 |
+ |
} |
|
82 |
+ |
return pExpectedDir; |
|
83 |
+ |
} |
|
84 |
+ |
|
73 |
85 |
|
public static void checkDirectoryable( File pExpectedDir ) |
74 |
86 |
|
throws FileSystemException |
75 |
87 |
|
{ |
|
@@ -112,16 +124,16 @@ |
112 |
124 |
|
|
113 |
125 |
|
public static void moveAllFiles( String pFromPath, String pToPath ) |
114 |
126 |
|
{ |
115 |
|
- |
File zFrom = new File( pFromPath ); |
116 |
|
- |
if ( !zFrom.isDirectory() ) |
117 |
|
- |
{ |
118 |
|
- |
throw new FileSystemException( "Not a Directory: " + zFrom.getAbsolutePath() ); |
119 |
|
- |
} |
|
127 |
+ |
File zFrom = assertDirectory( new File( pFromPath ) ); |
120 |
128 |
|
File zTo = insure( new File( pToPath ) ); |
121 |
|
- |
for ( File zFile : zFrom.listFiles() ) |
|
129 |
+ |
File[] zFiles = zFrom.listFiles(); |
|
130 |
+ |
if ( zFiles != null ) |
122 |
131 |
|
{ |
123 |
|
- |
String zName = zFile.getName(); |
124 |
|
- |
moveFile( zFile, new File( zTo, zName ) ); |
|
132 |
+ |
for ( File zFile : zFiles ) |
|
133 |
+ |
{ |
|
134 |
+ |
String zName = zFile.getName(); |
|
135 |
+ |
moveFile( zFile, new File( zTo, zName ) ); |
|
136 |
+ |
} |
125 |
137 |
|
} |
126 |
138 |
|
} |
127 |
139 |
|
|
|
@@ -373,7 +385,8 @@ |
373 |
385 |
|
|
374 |
386 |
|
if ( actual != expected ) |
375 |
387 |
|
{ |
376 |
|
- |
pIssues.append( "<br>Files '" ).append( mName ).append( "' Lengths MisMatch " ).append( "Actual(" ).append( actual ).append( ") != Expected(" ).append( expected ).append( ")" ); |
|
388 |
+ |
pIssues.append( "<br>Files '" ).append( mName ).append( "' Lengths MisMatch " ).append( "Actual(" ).append( actual ).append( ") != Expected(" ) |
|
389 |
+ |
.append( expected ).append( ")" ); |
377 |
390 |
|
} |
378 |
391 |
|
} |
379 |
392 |
|
|