Skip to content

Commit

Permalink
Merge pull request #1596 from codefori/fix/windowsFullPath
Browse files Browse the repository at this point in the history
Use OS dependant function to get relative path
  • Loading branch information
sebjulliand authored Nov 18, 2023
2 parents 4b20187 + 8ed2e82 commit 289826e
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/api/CompileTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,23 +219,16 @@ export namespace CompileTools {
evfeventInfo.object = name.toUpperCase();
evfeventInfo.extension = ext;

let relativePath;
let fullPath

switch (chosenAction.type) {
case `file`:
variables.set(`&LOCALPATH`, uri.fsPath);

let baseDir = config.homeDirectory;

if (fromWorkspace) {
baseDir = fromWorkspace.uri.path;

relativePath = path.posix.relative(baseDir, uri.path).split(path.sep).join(path.posix.sep);
const relativePath = path.relative(fromWorkspace.uri.path, uri.path).split(path.sep).join(path.posix.sep);
variables.set(`&RELATIVEPATH`, relativePath);

// We need to make sure the remote path is posix
fullPath = path.posix.join(config.homeDirectory, relativePath).split(path.sep).join(path.posix.sep);
const fullPath = path.posix.join(config.homeDirectory, relativePath);
variables.set(`&FULLPATH`, fullPath);
variables.set(`{path}`, fullPath);

Expand All @@ -258,7 +251,7 @@ export namespace CompileTools {
break;

case `streamfile`:
relativePath = path.posix.relative(config.homeDirectory, uri.fsPath).split(path.sep).join(path.posix.sep);
const relativePath = path.posix.relative(config.homeDirectory, uri.path);
variables.set(`&RELATIVEPATH`, relativePath);

const fullName = uri.path;
Expand Down

0 comments on commit 289826e

Please sign in to comment.