Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Migliorata gestione FTP


git-svn-id: svn://10.65.10.50/branches/R_10_00@22201 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2011-06-01 10:15:46 +00:00
parent 56017c05a0
commit 0c8e0c4737
3 changed files with 47 additions and 34 deletions

@ -1817,7 +1817,6 @@ SLIST xvt_fsys_list_files(const char *type, const char *pat, BOOLEAN dirs)
{
SLIST list = xvt_slist_create();
int flags = 0;
if (dirs)
{
@ -1827,45 +1826,45 @@ SLIST xvt_fsys_list_files(const char *type, const char *pat, BOOLEAN dirs)
else
flags = wxFILE;
wxURL url(pat);
const wxURL url(pat);
if (url.GetScheme() == "ftp")
{
const wxString strHost = url.GetServer();
const wxString strUser = url.GetUser();
const wxString strPwd = url.GetPassword();
const wxFileName fnPath = url.GetPath();
const wxString fnDir = fnPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
const wxString fnName = fnPath.GetFullName();
wxString RemotePath(pat);
const wxString fnDir = fnPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
const wxString fnName = fnPath.GetFullName();
const int mask = dirs ? (strcmp(type, DIR_TYPE) == 0 ? 2 : 3) : 1;
wxFTP ftp;
RemotePath = RemotePath.BeforeLast('/');
if (!strUser.IsEmpty())
{
ftp.SetUser(strUser);
ftp.SetPassword(strPwd);
}
if (ftp.Connect(strHost))
if (ftp.ChDir(fnDir))
{
wxArrayString files;
ftp.GetDirList(files, fnName);
for (size_t i = 0; i < files.GetCount(); i++)
const bool bConnected = ftp.Connect(strHost);
if (bConnected && ftp.ChDir(fnDir))
{
wxString RemotePath = pat;
RemotePath = RemotePath.BeforeLast('/');
wxArrayString files;
ftp.GetList(files, fnName, true);
for (size_t i = 0; i < files.GetCount(); i++)
{
const int type = files[i][0] == 'd' ? 2 : 1;
if (type & mask)
{
int type = files[i][0] == 'd' ? 2 : 1;
if (type & mask)
{
wxString f(RemotePath);
wxString f(RemotePath);
f << '/' << files[i].AfterLast(' ');
wxString size = files[i].Mid(30);
xvt_slist_add_at_elt(list, NULL, f, type == 2 ? -1 : wxAtol(size));
}
f << '/' << files[i].AfterLast(' ');
wxString size = files[i].Mid(30);
xvt_slist_add_at_elt(list, NULL, f, type == 2 ? -1 : wxAtol(size));
}
}
}
}
}
else //normale list_files
{
@ -3743,8 +3742,8 @@ BOOLEAN xvt_sys_set_env(const char* varname, const char* value)
// BOOLEAN o int? Adso!
int xvt_fsys_access(const char *pathname, int mode)
{
wxURL url(pathname);
wxString scheme = url.GetScheme();
const wxURL url(pathname);
const wxString scheme = url.GetScheme();
if (scheme == "ftp" || scheme == "http")
{
@ -3752,6 +3751,26 @@ int xvt_fsys_access(const char *pathname, int mode)
return ENOEXEC;
if (mode & 2 && scheme == "http")
return EACCES;
if (scheme == "ftp")
{
const wxFileName fnPath = url.GetPath();
const wxString fnDir = fnPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
const wxString fnName = fnPath.GetFullName();
if (fnName.IsEmpty()) // Test for directory existence
{
const wxString strHost = url.GetServer();
const wxString strUser = url.GetUser();
const wxString strPwd = url.GetPassword();
wxFTP ftp;
if (!strUser.IsEmpty())
{
ftp.SetUser(strUser);
ftp.SetPassword(strPwd);
}
return ftp.Connect(strHost) && ftp.ChDir(fnDir) ? 0 : EACCES;
}
}
SLIST files = xvt_fsys_list_files("", pathname, true);
const int count = xvt_slist_count(files);

@ -536,6 +536,7 @@ long xvt_fmap_get_families(PRINT_RCD *precp, char **family_array, long max_famil
void xvt_print_close(void)
{
// Nothing to do ?
m_PrintoutCache.Reset();
}
BOOLEAN xvt_print_close_page(PRINT_RCD* WXUNUSED(precp))
@ -547,7 +548,7 @@ BOOLEAN xvt_print_close_page(PRINT_RCD* WXUNUSED(precp))
wxDC* dc = po.GetDC();
dc->EndPage();
GetTDCMapper().DestroyTDC(PRINTER_WIN); // Elimina dalla lista dei display context
//GetTDCMapper().DestroyTDC(PRINTER_WIN); // Elimina dalla lista dei display context
}
return ok;
}

@ -242,10 +242,7 @@ bool TDC::ClipChanged() const
}
#ifdef LINUX
bool is_printer_dc(wxDC * dc)
{
return wxDynamicCast(dc, wxPostScriptDC) != NULL;
}
bool is_printer_dc(wxDC * dc) { return wxDynamicCast(dc, wxPostScriptDC) != NULL; }
#endif
#define NULL_CLIP_SIZE 32000
@ -293,7 +290,6 @@ wxDC& TDC::GetDC(bool bPaint)
{
#ifdef LINUX
if(!is_printer_dc(_dc))
{
#endif
switch(_dct.mode)
{
@ -307,9 +303,6 @@ wxDC& TDC::GetDC(bool bPaint)
case M_NOT_CLEAR:_dc->SetLogicalFunction(wxSET); break;
default: SORRY_BOX();
}
#ifdef LINUX
}
#endif
_real_dct.mode = _dct.mode;
}