@@ -93,19 +93,21 @@ public static void CopyFile(string sourceFullPath, string destFullPath, bool ove
9393 {
9494 destFullPath = Path . Combine ( destFullPath , Path . GetFileName ( sourceFullPath ) ) ;
9595 }
96-
97- // Copy the contents of the file from the source to the destination, creating the destination in the process
98- using ( var src = new FileStream ( sourceFullPath , FileMode . Open ) )
99- using ( var dst = new FileStream ( destFullPath , overwrite ? FileMode . Create : FileMode . CreateNew ) )
96+ if ( ! File . Exists ( destFullPath ) || overwrite )
10097 {
101- int xSize = ( int ) src . Length ;
102- Global . mFileSystemDebugger . SendInternal ( $ "size of { sourceFullPath } is { xSize } bytes") ;
103- byte [ ] content = new byte [ xSize ] ;
104- Global . mFileSystemDebugger . SendInternal ( $ "content byte buffer allocated") ;
105- src . Read ( content , 0 , xSize ) ;
106- Global . mFileSystemDebugger . SendInternal ( $ "content byte buffer read") ;
107- dst . Write ( content , 0 , xSize ) ;
108- Global . mFileSystemDebugger . SendInternal ( $ "content byte buffer written") ;
98+ // Copy the contents of the file from the source to the destination, creating the destination in the process
99+ using ( var src = new FileStream ( sourceFullPath , FileMode . Open ) )
100+ using ( var dst = new FileStream ( destFullPath , overwrite ? FileMode . Create : FileMode . CreateNew ) )
101+ {
102+ int xSize = ( int ) src . Length ;
103+ Global . mFileSystemDebugger . SendInternal ( $ "size of { sourceFullPath } is { xSize } bytes") ;
104+ byte [ ] content = new byte [ xSize ] ;
105+ Global . mFileSystemDebugger . SendInternal ( $ "content byte buffer allocated") ;
106+ src . Read ( content , 0 , xSize ) ;
107+ Global . mFileSystemDebugger . SendInternal ( $ "content byte buffer read") ;
108+ dst . Write ( content , 0 , xSize ) ;
109+ Global . mFileSystemDebugger . SendInternal ( $ "content byte buffer written") ;
110+ }
109111 }
110112 }
111113 }
0 commit comments