]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsCacheItem.cpp
hand-crafted LyXErr
[lyx.git] / src / graphics / GraphicsCacheItem.cpp
index a1310385bb918c81bcb034f57b7cb60084ac615b..882c44b46b8e3a5f5be5db4250c7fd5b85c80d2d 100644 (file)
@@ -34,7 +34,6 @@ using support::FileName;
 using support::makeDisplayPath;
 using support::onlyFilename;
 using support::tempName;
-using support::unlink;
 using support::unzipFile;
 
 using std::endl;
@@ -224,11 +223,11 @@ void CacheItem::Impl::reset()
 {
        zipped_ = false;
        if (!unzipped_filename_.empty())
-               unlink(unzipped_filename_);
+               unzipped_filename_.removeFile();
        unzipped_filename_.erase();
 
        if (remove_loaded_file_ && !file_to_load_.empty())
-               unlink(file_to_load_);
+               file_to_load_.removeFile();
        remove_loaded_file_ = false;
        file_to_load_.erase();
        to_.erase();
@@ -269,14 +268,14 @@ void CacheItem::Impl::imageConverted(bool success)
        converter_.reset();
        cc_.disconnect();
 
-       success = !file_to_load_.empty() && file_to_load_.isFileReadable();
+       success = !file_to_load_.empty() && file_to_load_.isReadableFile();
 
        if (!success) {
                LYXERR(Debug::GRAPHICS, "Unable to find converted file!");
                setStatus(ErrorConverting);
 
                if (zipped_)
-                       unlink(unzipped_filename_);
+                       unzipped_filename_.removeFile();
 
                return;
        }
@@ -295,7 +294,7 @@ void CacheItem::Impl::loadImage()
        setStatus(Loading);
        LYXERR(Debug::GRAPHICS, "Loading image.");
 
-       image_ = Image::newImage();
+       image_.reset(Image::newImage());
 
        cl_.disconnect();
        cl_ = image_->finishedLoading.connect(
@@ -311,10 +310,10 @@ void CacheItem::Impl::imageLoaded(bool success)
 
        // Clean up after loading.
        if (zipped_)
-               unlink(unzipped_filename_);
+               unzipped_filename_.removeFile();
 
        if (remove_loaded_file_ && unzipped_filename_ != file_to_load_)
-               unlink(file_to_load_);
+               file_to_load_.removeFile();
 
        cl_.disconnect();
 
@@ -370,7 +369,7 @@ void CacheItem::Impl::convertToDisplayFormat()
        setStatus(Converting);
 
        // First, check that the file exists!
-       if (!filename_.isFileReadable()) {
+       if (!filename_.isReadableFile()) {
                if (status_ != ErrorNoFile) {
                        setStatus(ErrorNoFile);
                        LYXERR(Debug::GRAPHICS, "\tThe file is not readable");
@@ -430,7 +429,7 @@ void CacheItem::Impl::convertToDisplayFormat()
 
        // Remove the temp file, we only want the name...
        // FIXME: This is unsafe!
-       unlink(to_file_base);
+       to_file_base.removeFile();
 
        // Connect a signal to this->imageConverted and pass this signal to
        // the graphics converter so that we can load the modified file