Patch level : 10.0 no patch

Files correlati     : ps0398.exe
Ricompilazione Demo : [ ]
Commento

E' possibile ora copiare file da e verso ftp.


git-svn-id: svn://10.65.10.50/branches/R_10_00@20987 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2010-10-11 14:39:38 +00:00
parent 566d5f1852
commit de3ebb3f29
2 changed files with 47 additions and 71 deletions

View File

@ -95,7 +95,8 @@ TPerformance_profiler::~TPerformance_profiler()
bool fcopy( bool fcopy(
const char* orig, // @parm Nome del file di origine const char* orig, // @parm Nome del file di origine
const char* dest, // @parm Nome del file di destinazione const char* dest, // @parm Nome del file di destinazione
bool append) // @parm Controllo per aggiungere il contenuto del bool append, // @parm Controllo per aggiungere il contenuto del
bool advanced) // @parm Controllo per utilizzare la xvt_fsys_fcopy
// file <p dest> in coda al file <p orig> (default FALSE) // file <p dest> in coda al file <p orig> (default FALSE)
// @comm Nel caso vengano ravvisati degli errori durante l'operazione vengono // @comm Nel caso vengano ravvisati degli errori durante l'operazione vengono
@ -103,6 +104,8 @@ bool fcopy(
{ {
CHECK(orig && *orig && dest && *dest, "fcopy: Invalid file name"); CHECK(orig && *orig && dest && *dest, "fcopy: Invalid file name");
if (append || !advanced)
{
const char* const rflag = "rb"; const char* const rflag = "rb";
const char* wflag = append ? "ab" : "wb"; const char* wflag = append ? "ab" : "wb";
@ -142,6 +145,10 @@ bool fcopy(
return ok; return ok;
} }
else
return xvt_fsys_fcopy(orig, dest) != 0 ;
}
// @doc EXTERNAL // @doc EXTERNAL
@ -200,46 +207,15 @@ int list_files(
TString_array& result) // @parm Array da riempire con la lista dei file TString_array& result) // @parm Array da riempire con la lista dei file
{ {
TFilename dir(filelist); TString mask(filelist);
int i;
for (i = dir.len()-1; i >= 0; i--) mask.replace('\\', '/');
if (dir[i] == '/' || dir[i] == '\\' || dir[i] == ':') break; SLIST files = xvt_fsys_list_files("", mask, FALSE);
TFilename mask(dir.mid(i+1));
dir.cut(i > 0 ? i+1 : 0);
xvt_fsys_save_dir();
if (dir.not_empty())
{
DIRECTORY directory; xvt_fsys_convert_str_to_dir(dir.get_buffer(), &directory);
BOOLEAN ok = xvt_fsys_set_dir(&directory);
if (!ok)
{
error_box("Impossibile entrare in %s", (const char*)dir);
return 0;
}
}
SLIST files = xvt_fsys_list_files("", mask.get_buffer(), FALSE);
const int count = xvt_slist_count(files); const int count = xvt_slist_count(files);
for (SLIST_ELT e = xvt_slist_get_first(files); e; e = xvt_slist_get_next(files, e)) for (SLIST_ELT e = xvt_slist_get_first(files); e; e = xvt_slist_get_next(files, e))
{ result.add(xvt_slist_get(files, e, NULL));
const char* f = xvt_slist_get(files, e, NULL);
if (dir.not_empty())
{
mask = dir;
mask.add(f);
result.add(mask);
}
else
result.add(f);
}
xvt_slist_destroy(files); xvt_slist_destroy(files);
xvt_fsys_restore_dir();
return count; return count;
} }

View File

@ -29,7 +29,7 @@ char* format (const char* fmt, ...);
const char* cmd2name(const char* argv0, const char* argv1 = ""); const char* cmd2name(const char* argv0, const char* argv1 = "");
int rtoi(const char * roman); int rtoi(const char * roman);
const char* itor(int i); const char* itor(int i);
bool fcopy(const char* orig, const char* dest, bool append = false); bool fcopy(const char* orig, const char* dest, bool append = false, bool advanced = false);
bool fexist(const char* file); bool fexist(const char* file);
long fsize(const char* file); long fsize(const char* file);