Supporto per operazioni su gruppi di file
git-svn-id: svn://10.65.10.50/branches/R_10_00@22989 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
46582859fa
commit
97991f8e32
129
xvaga/agasys.cpp
129
xvaga/agasys.cpp
@ -26,29 +26,6 @@ static unsigned int aga_getziplist(const char* zipfile, wxArrayString& aFiles)
|
||||
return aFiles.GetCount();
|
||||
}
|
||||
|
||||
/*
|
||||
static int aga_find_slash(const wxString& path, int from)
|
||||
{
|
||||
for (int i = from; path[i]; i++)
|
||||
if (wxIsPathSeparator(path[i]))
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
static bool aga_create_dir(wxString strPath)
|
||||
{
|
||||
bool ok = wxFileName::Mkdir(strPath, 0x777, wxPATH_MKDIR_FULL);
|
||||
if (!ok)
|
||||
{
|
||||
wxString strMsg;
|
||||
strMsg << "Impossibile creare la cartella " << strPath;
|
||||
xvt_dm_post_error(strMsg);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool aga_unzip(const char* zipfile, const char* destdir)
|
||||
{
|
||||
wxArrayString aFiles;
|
||||
@ -70,7 +47,7 @@ bool aga_unzip(const char* zipfile, const char* destdir)
|
||||
if (!wxEndsWithPathSeparator(strOutDir))
|
||||
strOutDir += wxFILE_SEP_PATH;
|
||||
strOutDir += strFileName;
|
||||
aga_create_dir(strOutDir);
|
||||
xvt_fsys_mkdir(strOutDir);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -90,7 +67,7 @@ bool aga_unzip(const char* zipfile, const char* destdir)
|
||||
|
||||
wxString strPath;
|
||||
::wxSplitPath(strOutFile, &strPath, NULL, NULL);
|
||||
aga_create_dir(strPath);
|
||||
xvt_fsys_mkdir(strPath);
|
||||
|
||||
wxFileOutputStream fout(strOutFile);
|
||||
fout.Write(fin);
|
||||
@ -238,6 +215,108 @@ bool aga_dde_terminate(unsigned long connection)
|
||||
return ok;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Multi file operations
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
/* Solo da Vista in poi...
|
||||
#include <Shobjidl.h>
|
||||
#include <ShlGUID.h>
|
||||
|
||||
static IFileOperation* CreatePFO()
|
||||
{
|
||||
return NULL;
|
||||
HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||
if (!SUCCEEDED(hr))
|
||||
return NULL;
|
||||
|
||||
IFileOperation *pfo = NULL;
|
||||
hr = ::CoCreateInstance(CLSID_FileOperation, NULL, CLSCTX_ALL, IID_PPV_ARGS(&pfo));
|
||||
if (!SUCCEEDED(hr))
|
||||
return NULL;
|
||||
|
||||
pfo->SetOperationFlags(FOF_NOCONFIRMATION);
|
||||
|
||||
return pfo;
|
||||
}
|
||||
|
||||
static void DeleteIUnknown(IUnknown* iu)
|
||||
{
|
||||
if (iu)
|
||||
{
|
||||
iu->Release();
|
||||
iu = NULL;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
int xvt_fsys_files_remove(const char* src, SLIST names)
|
||||
{
|
||||
/*
|
||||
int nDone = 0;
|
||||
IFileOperation *pfo = CreatePFO();
|
||||
if (!pfo)
|
||||
return -1;
|
||||
|
||||
HRESULT hr = 0;
|
||||
|
||||
if (xvt_slist_count(names) == 0)
|
||||
{
|
||||
wxString n = src;
|
||||
wxWritableWCharBuffer wcb = n.wchar_str();
|
||||
IShellItem* psiFolder = NULL;
|
||||
hr = ::SHCreateItemFromParsingName(wcb, NULL, IID_PPV_ARGS(&psiFolder));
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
IEnumShellItems* pEnum = NULL;
|
||||
hr = psiFolder->BindToHandler(NULL, BHID_EnumItems, IID_IEnumShellItems, (void**)&pEnum);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = pfo->DeleteItems(pEnum);
|
||||
if (SUCCEEDED(hr))
|
||||
nDone++;
|
||||
DeleteIUnknown(pEnum);
|
||||
}
|
||||
DeleteIUnknown(psiFolder);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (SLIST_ELT e = xvt_slist_get_first(names); e; e = xvt_slist_get_next(names, e))
|
||||
{
|
||||
wxFileName n = xvt_slist_get(names, e, NULL);
|
||||
if (!n.IsAbsolute())
|
||||
n.PrependDir(src);
|
||||
wxWritableWCharBuffer wcb = n.GetFullPath().wchar_str();
|
||||
IShellItem* psiItem = NULL;
|
||||
hr = ::SHCreateItemFromParsingName(wcb, NULL, IID_PPV_ARGS(&psiItem));
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = pfo->DeleteItem(psiItem, NULL);
|
||||
if (SUCCEEDED(hr))
|
||||
nDone++;
|
||||
DeleteIUnknown(psiItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hr = pfo->PerformOperations();
|
||||
DeleteIUnknown(pfo);
|
||||
return SUCCEEDED(hr) ? nDone : -1;
|
||||
*/
|
||||
return -1; // Not implemented yet
|
||||
}
|
||||
|
||||
int xvt_fsys_files_copy(const char* src, SLIST names, const char* dst)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int xvt_fsys_files_move(const char* src, SLIST names, const char* dst)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TProgressIndicator
|
||||
///////////////////////////////////////////////////////////
|
||||
|
@ -3004,6 +3004,10 @@ void xvt_sbar_set_range(WINDOW win, SCROLL_TYPE t, int min, int max)
|
||||
{
|
||||
CAST_GAUGE(win, g);
|
||||
g.SetRange(max);
|
||||
if (max > 1)
|
||||
g.SetDeterminateMode();
|
||||
else
|
||||
g.SetIndeterminateMode();
|
||||
}
|
||||
break;
|
||||
case HVSLIDER:
|
||||
|
@ -212,6 +212,10 @@ XVTDLL const char* xvt_fsys_get_campo_ini();
|
||||
XVTDLL long xvt_fsys_file_attr(const char* pathname, long attr);
|
||||
XVTDLL BOOLEAN xvt_fsys_file_md5(const char* path, char* outstr32);
|
||||
|
||||
XVTDLL int xvt_fsys_files_copy (const char* src, SLIST names, const char* dst);
|
||||
XVTDLL int xvt_fsys_files_move (const char* src, SLIST names, const char* dst);
|
||||
XVTDLL int xvt_fsys_files_remove(const char* src, SLIST names);
|
||||
|
||||
XVTDLL void xvt_help_close_helpfile(XVT_HELP_INFO hi);
|
||||
XVTDLL XVT_HELP_INFO xvt_help_open_helpfile(FILE_SPEC *fs, unsigned long flags);
|
||||
XVTDLL BOOLEAN xvt_help_process_event(XVT_HELP_INFO hi, WINDOW win, EVENT *ev);
|
||||
|
Loading…
x
Reference in New Issue
Block a user