From: <mg...@us...> - 2008-02-16 11:04:48
|
Revision: 835 http://planeshift.svn.sourceforge.net/planeshift/?rev=835&view=rev Author: mgist Date: 2008-02-16 03:04:52 -0800 (Sat, 16 Feb 2008) Log Message: ----------- - Noob error in directory copying. Modified Paths: -------------- trunk/src/common/util/fileutil.cpp Modified: trunk/src/common/util/fileutil.cpp =================================================================== --- trunk/src/common/util/fileutil.cpp 2008-02-16 09:26:34 UTC (rev 834) +++ trunk/src/common/util/fileutil.cpp 2008-02-16 11:04:52 UTC (rev 835) @@ -197,32 +197,29 @@ n2= to; } - if(statTo->TYPE_DIRECTORY) + FileStat* statFrom = StatFile(fileFrom); + + if(statFrom->TYPE_DIRECTORY) { if(!vfs->Exists(n2)) { MakeDirectory(n2); } - - FileStat* statFrom = StatFile(fileFrom); - - if(statFrom->TYPE_DIRECTORY) + else if(statTo->TYPE_FILE) { - csRef<iStringArray> fileList = vfs->FindFiles(n1); - for(uint i=0; i<fileList->GetSize(); i++) - { - csString file = fileList->Get(i); - csString currentTo = n2; - currentTo.AppendFmt("/%s", file.Slice(file.FindLast('/')).GetData()); - CopyFile(file, currentTo, true, isExecutable(file)); - } - } - else - { if(!silent) printf("Can't write a file where a directory already exists.\n", fileTo.GetData()); return false; } + + csRef<iStringArray> fileList = vfs->FindFiles(n1); + for(uint i=0; i<fileList->GetSize(); i++) + { + csString file = fileList->Get(i); + csString currentTo = n2; + currentTo.AppendFmt("/%s", file.Slice(file.FindLast('/')).GetData()); + CopyFile(file, currentTo, true, isExecutable(file)); + } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |