pucelle/vscode-run-on-save

add right slash transform

Closed this issue · 3 comments

Deno doesn't like left-slashes \ on Windows for some reason. So locally I added:

...
            piece = piece.replace(/\${fileRightslash}/g, this.rightSlash(filePath));
            piece = piece.replace(/\${fileRelativeRightslash}/g, this.rightSlash(path.
...
    rightSlash(filePath) {
        let dir = filePath.replace(/\\/g, '/');
        if (!dir) {
            dir = filePath[0] || '';
        }
        return dir;
    }

I don't know if that's the API you would like to add, but I needed it to get your handy plugin to work with Deno.
I was about to make a PR, but I don't know TS yet.

cheers

How about a new command option: forceSlash = / or \ or Platform Specified ?

"command option: forceSlash" sounds good, but I needed to get around my platform (Win) standard of \.

I add a new option forcePathSeparator and release v1.4.0.