Skip to content

TagSpaces is an offline, open source, document manager with tagging support

optimizing the error handling of opening paths

Ilianbb1172b9cd6a
diff --git a/data/js/postioapi.js b/data/js/postioapi.js
index fe46f04cc..77ba85df7 100644
--- a/data/js/postioapi.js
+++ b/data/js/postioapi.js
@@ -95,10 +95,18 @@ define(function(require, exports, module) {
}
};
- exports.errorOpeningPath = function() {
- TSCORE.showAlertDialog($.i18n.t("ns.dialogs:errorOpeningLocationAlert"));
- //TSCORE.closeCurrentLocation();
- };
+ exports.errorOpeningPath = function(dirPath) {
+ // Normalazing the paths
+ var dir1 = TSCORE.TagUtils.cleanTrailingDirSeparator(TSCORE.currentLocationObject.path);
+ var dir2 = TSCORE.TagUtils.cleanTrailingDirSeparator(dirPath);
+ // Close the current location if the its path could not be opened
+ if(dir1 === dir2) {
+ TSCORE.showAlertDialog($.i18n.t("ns.dialogs:errorOpeningLocationAlert"));
+ TSCORE.closeCurrentLocation();
+ } else {
+ TSCORE.showAlertDialog($.i18n.t("ns.dialogs:errorOpeningPathAlert"));
+ }
+ };
exports.deleteElement = function(filePath) {
TSCORE.removeFileModel(TSCORE.fileList, filePath);