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

View File

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

View File

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

View File

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