mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-08-11 03:12:44 +02:00
#536 - Update relative path
This commit is contained in:
@@ -175,11 +175,14 @@ export class Folders {
|
||||
let staticFolder = Settings.get<string>(SETTING_CONTENT_STATIC_FOLDER);
|
||||
|
||||
if (staticFolder && (staticFolder.includes(WORKSPACE_PLACEHOLDER) || staticFolder === '/')) {
|
||||
staticFolder = Folders.getAbsFilePath(staticFolder);
|
||||
staticFolder =
|
||||
staticFolder === '/'
|
||||
? Folders.getAbsFilePath('[[workspace]]')
|
||||
: Folders.getAbsFilePath(staticFolder);
|
||||
const wsFolder = Folders.getWorkspaceFolder();
|
||||
if (wsFolder) {
|
||||
const relativePath = relative(parseWinPath(wsFolder.fsPath), parseWinPath(staticFolder));
|
||||
return relativePath;
|
||||
return relativePath === '' ? '/' : relativePath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,10 @@ export const Item: React.FunctionComponent<IItemProps> = ({
|
||||
|
||||
relPath = mediaParsed.split(wsFolderParsed).pop();
|
||||
|
||||
if (settings.staticFolder && relPath) {
|
||||
// If the static folder is the root, we can just return the relative path
|
||||
if (settings.staticFolder === "/") {
|
||||
return relPath;
|
||||
} else if (settings.staticFolder && relPath) {
|
||||
const staticFolderParsed = parseWinPath(settings.staticFolder);
|
||||
relPath = relPath.split(staticFolderParsed).pop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user