Fixed account directory clear: don't add path separator when listing the directory. Fixed account directory setup: properly check the error when listing the parent directory.
git-svn-id: http://voip.null.ro/svn/yate@4250 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
78532b310b
commit
498ccacd68
|
@ -4075,7 +4075,7 @@ bool ClientAccount::setupDataDir(String* errStr, bool saveAcc)
|
||||||
int error = 0;
|
int error = 0;
|
||||||
ObjList dirs;
|
ObjList dirs;
|
||||||
ObjList files;
|
ObjList files;
|
||||||
File::listDirectory(path,&dirs,&files);
|
File::listDirectory(path,&dirs,&files,&error);
|
||||||
if (error)
|
if (error)
|
||||||
return showAccError(this,errStr,"Failed to list directory",path,error);
|
return showAccError(this,errStr,"Failed to list directory",path,error);
|
||||||
String fullPath = path + Engine::pathSeparator() + dir;
|
String fullPath = path + Engine::pathSeparator() + dir;
|
||||||
|
@ -4186,13 +4186,13 @@ bool ClientAccount::clearDataDir(String* errStr)
|
||||||
if (!dirs.find(dir))
|
if (!dirs.find(dir))
|
||||||
return true;
|
return true;
|
||||||
// Delete files
|
// Delete files
|
||||||
tmp << Engine::pathSeparator() << dir << Engine::pathSeparator();
|
tmp << Engine::pathSeparator() << dir;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
ObjList files;
|
ObjList files;
|
||||||
if (File::listDirectory(tmp,0,&files,&error)) {
|
if (File::listDirectory(tmp,0,&files,&error)) {
|
||||||
for (ObjList* o = files.skipNull(); o; o = o->skipNext()) {
|
for (ObjList* o = files.skipNull(); o; o = o->skipNext()) {
|
||||||
String file(tmp + o->get()->toString());
|
String file(tmp + Engine::pathSeparator() + o->get()->toString());
|
||||||
int err = 0;
|
int err = 0;
|
||||||
if (!File::remove(file,&err)) {
|
if (!File::remove(file,&err)) {
|
||||||
if (!error)
|
if (!error)
|
||||||
|
|
Loading…
Reference in New Issue