Skip to content

Commit

Permalink
Delete within a filer folder working #3
Browse files Browse the repository at this point in the history
  • Loading branch information
abose committed Oct 11, 2021
1 parent ce135e4 commit c1ace0a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/phoenix/fslib.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import Constants from "./constants.js";
import Mounts from "./fslib_mounts.js";

let filerLib = null;
let filerShell = null;

/**
* Offers functionality similar to mkdir -p
Expand Down Expand Up @@ -114,8 +115,8 @@ const fileSystemLib = {
rename: function (...args) {
return filerLib.fs.rename(...args);
},
unlink: function (...args) {
return filerLib.fs.unlink(...args);
unlink: function (path, cb) {
return filerShell.rm(path, { recursive: true }, cb);
},
showSaveDialog: function () {
throw new Errors.ENOSYS('Phoenix fs showSaveDialog function not yet supported.');
Expand Down Expand Up @@ -146,6 +147,7 @@ const fileSystemLib = {

export default function initFsLib(Phoenix, FilerLib) {
filerLib = FilerLib;
filerShell = new filerLib.fs.Shell();
window.path = FilerLib.path;
window.fs = fileSystemLib;

Expand Down
4 changes: 2 additions & 2 deletions src/preferences/PreferencesBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ define(function (require, exports, module) {
if (createIfMissing) {
// Unreadable file is also unwritable -- delete so get recreated
if (recreateIfInvalid && (err === FileSystemError.NOT_READABLE || err === FileSystemError.UNSUPPORTED_ENCODING)) {
appshell.fs.moveToTrash(path, function (err) {
appshell.fs.unlink(path, function (err) {
if (err) {
console.log("Cannot move unreadable preferences file " + path + " to trash!!");
} else {
Expand All @@ -208,7 +208,7 @@ define(function (require, exports, module) {
} catch (e) {
if (recreateIfInvalid) {
// JSON parsing error -- recreate the preferences file
appshell.fs.moveToTrash(path, function (err) {
appshell.fs.unlink(path, function (err) {
if (err) {
console.log("Cannot move unparseable preferences file " + path + " to trash!!");
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ define(function (require, exports, module) {
function deleteItem(entry) {
var result = new $.Deferred();

entry.moveToTrash(function (err) {
entry.unlink(function (err) {
if (!err) {
DocumentManager.notifyPathDeleted(entry.fullPath);
result.resolve();
Expand Down

0 comments on commit c1ace0a

Please sign in to comment.