Begin removing simple pass-through wrapper for POSIX-style file system functions from safegtk module.

This commit is contained in:
Adam Reichold
2015-12-26 01:35:22 +01:00
parent b62b78e2f8
commit 747a28014b
11 changed files with 248 additions and 277 deletions

View File

@@ -376,7 +376,7 @@ Glib::ustring BatchQueue::getTempFilenameForParams( const Glib::ustring filename
strftime (stringTimestamp, sizeof(stringTimestamp), "_%Y%m%d%H%M%S_", timeinfo);
Glib::ustring savedParamPath;
savedParamPath = options.rtdir + "/batch/";
safe_g_mkdir_with_parents (savedParamPath, 0755);
g_mkdir_with_parents (savedParamPath.c_str (), 0755);
savedParamPath += Glib::path_get_basename (filename);
savedParamPath += stringTimestamp;
savedParamPath += paramFileExtension;
@@ -385,8 +385,11 @@ Glib::ustring BatchQueue::getTempFilenameForParams( const Glib::ustring filename
int cancelItemUI (void* data)
{
safe_g_remove( (static_cast<BatchQueueEntry*>(data))->savedParamsFile );
delete static_cast<BatchQueueEntry*>(data);
const auto bqe = static_cast<BatchQueueEntry*>(data);
g_remove (bqe->savedParamsFile.c_str ());
delete bqe;
return 0;
}
@@ -671,8 +674,8 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img)
processing->removeButtonSet ();
}
if (saveBatchQueue( )) {
safe_g_remove( processedParams );
if (saveBatchQueue ()) {
::g_remove (processedParams.c_str ());
// Delete all files in directory \batch when finished, just to be sure to remove zombies
// Not sure that locking is necessary, but it should be safer
@@ -686,8 +689,8 @@ rtengine::ProcessingJob* BatchQueue::imageReady (rtengine::IImage16* img)
Glib::RefPtr<Gio::File> dir = Gio::File::create_for_path (batchdir);
safe_build_file_list (dir, names, batchdir);
for(std::vector<Glib::ustring>::iterator iter = names.begin(); iter != names.end(); iter++ ) {
safe_g_remove( *iter );
for (auto iter = names.begin (); iter != names.end (); ++iter) {
::g_remove (iter->c_str ());
}
}
}
@@ -834,8 +837,8 @@ Glib::ustring BatchQueue::autoCompleteFileName (const Glib::ustring& fileName, c
Glib::ustring fname;
// create directory, if does not exist
if (safe_g_mkdir_with_parents (dstdir, 0755) ) {
return "";
if (g_mkdir_with_parents (dstdir.c_str (), 0755)) {
return Glib::ustring ();
}
// In overwrite mode we TRY to delete the old file first.
@@ -852,7 +855,7 @@ Glib::ustring BatchQueue::autoCompleteFileName (const Glib::ustring& fileName, c
int fileExists = safe_file_test (fname, Glib::FILE_TEST_EXISTS);
if (inOverwriteMode && fileExists) {
if (safe_g_remove(fname) == -1) {
if (::g_remove (fname.c_str ()) != 0) {
inOverwriteMode = false; // failed to delete- revert to old naming scheme
} else {
fileExists = false; // deleted now