Skip to content

Commit

Permalink
Quick fix for broken path
Browse files Browse the repository at this point in the history
  • Loading branch information
Łukasz Jóźwiak authored and Łukasz Jóźwiak committed Dec 5, 2018
1 parent c5f6cab commit a5d2c1d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Use at your own risk - I do not guarantee that it will work correctly!
------

## Version history
- 0.3.6
- Added [ Fix for broken uploadOnSave and subdirectories not adding properly]
- 0.3.7
- Added [ Fix for broken uploadOnSave and subdirectories not adding properly](https://github.com/lukasz-wronski/vscode-ftp-sync/pull/264)
- 0.3.5
- Added [ Various enhancements (SCP Support, bug fixes, list command)](https://github.com/lukasz-wronski/vscode-ftp-sync/pull/237)
- Added [ List commands](https://github.com/lukasz-wronski/vscode-ftp-sync/pull/215)
Expand Down
2 changes: 1 addition & 1 deletion modules/dirpick.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var dirpick = function(callback, currentDir) {
var selectListPrefix = currentDir != "." ? ".." : "";
var options = [{ label: path.join(selectListPrefix, path.basename(currentDir)), description: "Choose this folder"}];

getDirectories(path.join(ftpconfig.rootPath().path, currentDir)).forEach(function(dir) {
getDirectories(path.join(ftpconfig.rootPath(), currentDir)).forEach(function(dir) {
options.push(path.join(selectListPrefix, path.basename(currentDir), dir));
})

Expand Down
6 changes: 3 additions & 3 deletions modules/downloadcurrent-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ module.exports = function(fileUrl, getFtpSync) {
return;
}

if (!ftpconfig.rootPath().path) {
if (!ftpconfig.rootPath()) {
vscode.window.showErrorMessage("Ftp-sync: Cannot init ftp-sync without opened folder");
return;
}

if (filePath.indexOf(ftpconfig.rootPath().path) < 0) {
if (filePath.indexOf(ftpconfig.rootPath()) < 0) {
vscode.window.showErrorMessage("Ftp-sync: Selected file is not a part of the workspace.");
return;
}
Expand All @@ -36,7 +36,7 @@ module.exports = function(fileUrl, getFtpSync) {

var fileName = path.basename(filePath);
var downloadStatus = vscode.window.setStatusBarMessage("Ftp-sync: Downloading " + fileName + " from FTP server...", STATUS_TIMEOUT);
getFtpSync().downloadFile(filePath, ftpconfig.rootPath().path, function(err) {
getFtpSync().downloadFile(filePath, ftpconfig.rootPath(), function(err) {
downloadStatus.dispose();
if (err)
vscode.window.showErrorMessage("Ftp-sync: Downloading " + fileName + " failed: " + err);
Expand Down
6 changes: 3 additions & 3 deletions modules/ftp-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ var upath = require("upath");

module.exports = {
rootPath: function() {
return vscode.workspace.workspaceFolders[0].uri;
return vscode.workspace.workspaceFolders[0].uri.fsPath;
},
getConfigPath: function() {
return this.getConfigDir() + "/ftp-sync.json";
},
getConfigDir: function() {
return this.rootPath().path + "/.vscode";
return this.rootPath() + "/.vscode";
},
getGeneratedDir: function() {
return upath.join(this.rootPath().path, this.generatedFiles.path);
return upath.join(this.rootPath(), this.generatedFiles.path);
},
defaultConfig: {
remotePath: "./",
Expand Down
2 changes: 1 addition & 1 deletion modules/init-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var fs = require('fs');

module.exports = function() {

if(!ftpconfig.rootPath().path) {
if(!ftpconfig.rootPath()) {
vscode.window.showErrorMessage("Ftp-sync: Cannot init ftp-sync without opened folder");
return;
}
Expand Down
8 changes: 4 additions & 4 deletions modules/list-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ module.exports = function(fileUrl, getFtpSync) {
return;
}

if (!ftpconfig.rootPath().path) {
if (!ftpconfig.rootPath()) {
vscode.window.showErrorMessage('Ftp-sync: Cannot init ftp-sync without opened folder');
return;
}

if (filePath.indexOf(ftpconfig.rootPath().path) < 0) {
if (filePath.indexOf(ftpconfig.rootPath()) < 0) {
vscode.window.showErrorMessage('Ftp-sync: Selected file is not a part of the workspace.');
return;
}
Expand All @@ -36,7 +36,7 @@ module.exports = function(fileUrl, getFtpSync) {
return;
}

let remotePath = getFatherPath(filePath.replace(ftpconfig.rootPath().path, config.remotePath));
let remotePath = getFatherPath(filePath.replace(ftpconfig.rootPath(), config.remotePath));
function listAllFiles(filesRemotePath) {
getFtpSync().ListRemoteFilesByPath(filesRemotePath, function(err, files) {
if (err) {
Expand Down Expand Up @@ -136,7 +136,7 @@ function getLabel(file) {
}
function getLocalPath(fileRemotePath) {
return {
fsPath: fileRemotePath.replace(ftpconfig.getConfig().remotePath, ftpconfig.rootPath().path)
fsPath: fileRemotePath.replace(ftpconfig.getConfig().remotePath, ftpconfig.rootPath())
};
}
function getFatherPath(son) {
Expand Down
4 changes: 2 additions & 2 deletions modules/on-save.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var upath = require("upath");

module.exports = function(document, getFtpSync, skipOnSaveCheck) {

if(document.uri.fsPath.indexOf(ftpconfig.rootPath().path) < 0)
if(document.uri.fsPath.indexOf(ftpconfig.rootPath()) < 0)
return;

var config = ftpconfig.getConfig();
Expand Down Expand Up @@ -40,7 +40,7 @@ module.exports = function(document, getFtpSync, skipOnSaveCheck) {
var fileName = path.basename(document.uri.fsPath);
var uploadingStatus = vscode.window.setStatusBarMessage("Ftp-sync: Uploading " + fileName + " to FTP server...");

getFtpSync().uploadFile(document.uri.fsPath, ftpconfig.rootPath().path, function(err) {
getFtpSync().uploadFile(document.uri.fsPath, ftpconfig.rootPath(), function(err) {
uploadingStatus.dispose();
if(err)
vscode.window.showErrorMessage("Ftp-sync: Uploading " + fileName + " failed: " + err);
Expand Down
6 changes: 3 additions & 3 deletions modules/sync-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = function(isUpload, getSyncHelper) {

var showSyncSummary = function(sync, options) {
var syncJson = JSON.stringify(sync, null, 4);
var filePath = path.normalize(ftpconfig.rootPath().path + "/.vscode/sync-summary-" + Math.floor(Date.now() / 1000) + ".json");
var filePath = path.normalize(ftpconfig.rootPath() + "/.vscode/sync-summary-" + Math.floor(Date.now() / 1000) + ".json");
var uri = vscode.Uri.parse("untitled:" + filePath);
var prepareSyncDocument = vscode.workspace.openTextDocument(uri);
prepareSyncDocument.then(function(document) {
Expand Down Expand Up @@ -103,8 +103,8 @@ module.exports = function(isUpload, getSyncHelper) {
if(!result) return;
var syncOptions = {
remotePath: path.join(getSyncHelper().getConfig().remote, dirPath),
localPath: path.join(ftpconfig.rootPath().path, dirPath),
rootPath: ftpconfig.rootPath().path,
localPath: path.join(ftpconfig.rootPath(), dirPath),
rootPath: ftpconfig.rootPath(),
upload: isUpload,
mode: result.mode
};
Expand Down
6 changes: 3 additions & 3 deletions modules/uploadcurrent-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ module.exports = function(fileUrl, getFtpSync) {
return;
}

if(!ftpconfig.rootPath().path) {
if(!ftpconfig.rootPath()) {
vscode.window.showErrorMessage("Ftp-sync: Cannot init ftp-sync without opened folder");
return;
}

if(filePath.indexOf(ftpconfig.rootPath().path) < 0) {
if(filePath.indexOf(ftpconfig.rootPath()) < 0) {
vscode.window.showErrorMessage("Ftp-sync: Selected file is not a part of the workspace.");
return;
}
Expand All @@ -36,7 +36,7 @@ module.exports = function(fileUrl, getFtpSync) {
var fileName = path.basename(filePath);
var uploadingStatus = vscode.window.setStatusBarMessage("Ftp-sync: Uploading " + fileName + " to FTP server...", STATUS_TIMEOUT);

getFtpSync().uploadFile(filePath, ftpconfig.rootPath().path, function(err) {
getFtpSync().uploadFile(filePath, ftpconfig.rootPath(), function(err) {
uploadingStatus.dispose();
if(err)
vscode.window.showErrorMessage("Ftp-sync: Uploading " + fileName + " failed: " + err);
Expand Down

0 comments on commit a5d2c1d

Please sign in to comment.