From b24ff519535886e47ffe2b38d5d822a83371a84a Mon Sep 17 00:00:00 2001 From: Donna Wu Date: Thu, 23 Aug 2012 14:21:31 +0800 Subject: [PATCH] [FileIO] Fix bug: confirm removal of non-existent image files --- src/js/projects.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/js/projects.js b/src/js/projects.js index fb82059d..0cbb54ac 100644 --- a/src/js/projects.js +++ b/src/js/projects.js @@ -978,10 +978,14 @@ $(function () { // TODO: will list all the uploaded resource and show the reference // count of them. It will depend on the user if delete or not. if (pmUtils.resourceRef[refPath] <= 0) { - $.rib.confirm('Unused resource: "' + refPath + - '". \nWould you like to delete it from the project?', function () { - $.rib.fsUtils.rm(projectDir + refPath); - delete pmUtils.resourceRef[refPath]; + delete pmUtils.resourceRef[refPath]; + $.rib.fsUtils.pathToEntry(projectDir + refPath, function (entry) { + $.rib.confirm('Unused resource: "' + entry.name + + '". \nWould you like to delete it from the project?', function () { + $.rib.fsUtils.rm(entry.fullPath); + }, function () { + pmUtils.resourceRef[refPath] = 0; + }); }); } } else {