mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 21:55:43 +01:00
[Summary] Merging from GIT
[Details] Starting point: Mar 24 2014, 11:47 PM Commit:87184ab80dTarget point: Commit:59e6694405Apr 16 2014, 4:01 PM [git-p4: depot-paths = "//Abdaw/dev_main/tracks/": change = 453690]
This commit is contained in:
parent
0046ee6488
commit
ce2a519afa
103 changed files with 2160 additions and 915 deletions
|
|
@ -94,3 +94,38 @@ PBD::clear_directory (const string& dir, size_t* size, vector<string>* paths)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// rm -rf <dir> -- used to remove saved plugin state
|
||||
void
|
||||
PBD::remove_directory (const std::string& dir) {
|
||||
DIR* dead;
|
||||
struct dirent* dentry;
|
||||
struct stat statbuf;
|
||||
|
||||
if ((dead = ::opendir (dir.c_str())) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while ((dentry = ::readdir (dead)) != 0) {
|
||||
if(!strcmp(dentry->d_name, ".") || !strcmp(dentry->d_name, "..")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
string fullpath = Glib::build_filename (dir, dentry->d_name);
|
||||
if (::stat (fullpath.c_str(), &statbuf)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (S_ISDIR (statbuf.st_mode)) {
|
||||
remove_directory(fullpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (::g_unlink (fullpath.c_str())) {
|
||||
error << string_compose (_("cannot remove file %1 (%2)"), fullpath, strerror (errno)) << endmsg;
|
||||
}
|
||||
}
|
||||
if (::g_rmdir(dir.c_str())) {
|
||||
error << string_compose (_("cannot remove directory %1 (%2)"), dir, strerror (errno)) << endmsg;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue