File tree 5 files changed +10
-6
lines changed
5 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 12
12
13
13
### 🐞 Fixes
14
14
15
+ - Fix for media folder parsing on Windows
15
16
- [ #909 ] ( https://github.com/estruyf/vscode-front-matter/issues/909 ) : Schema fix for the view modes
16
17
- [ #913 ] ( https://github.com/estruyf/vscode-front-matter/issues/913 ) : Fix for relative media paths in page bundles
17
18
- [ #914 ] ( https://github.com/estruyf/vscode-front-matter/issues/914 ) : Fix sanitizing of default filenames with an ` _ ` in it
Original file line number Diff line number Diff line change @@ -219,7 +219,9 @@ export class Folders {
219
219
: Folders . getAbsFilePath ( assetFolder ) ;
220
220
const wsFolder = Folders . getWorkspaceFolder ( ) ;
221
221
if ( wsFolder ) {
222
- const relativePath = relative ( parseWinPath ( wsFolder . fsPath ) , parseWinPath ( assetFolder ) ) ;
222
+ const relativePath = parseWinPath (
223
+ relative ( parseWinPath ( wsFolder . fsPath ) , parseWinPath ( assetFolder ) )
224
+ ) ;
223
225
return relativePath === '' ? '/' : relativePath ;
224
226
}
225
227
}
@@ -648,7 +650,7 @@ export class Folders {
648
650
649
651
const uniqueFolders = [ ...new Set ( folders ) ] ;
650
652
const relativeFolderPaths = uniqueFolders . map ( ( folder ) =>
651
- relative ( parseWinPath ( wsFolder . fsPath ) , folder )
653
+ parseWinPath ( relative ( parseWinPath ( wsFolder . fsPath ) , folder ) )
652
654
) ;
653
655
654
656
Logger . verbose ( 'Folders:getContentFolders:end' ) ;
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ export class FrameworkDetector {
137
137
const assetDir = dirname ( absAssetPath ) ;
138
138
const fileName = parse ( absAssetPath ) ;
139
139
140
- relAssetPath = relative ( fileDir , assetDir ) ;
140
+ relAssetPath = parseWinPath ( relative ( fileDir , assetDir ) ) ;
141
141
relAssetPath = join ( relAssetPath , `${ fileName . name } ${ fileName . ext } ` ) ;
142
142
}
143
143
// Support for HEXO image folder
@@ -197,7 +197,7 @@ export class FrameworkDetector {
197
197
const assetDir = dirname ( absAssetPath ) ;
198
198
const fileName = parse ( absAssetPath ) ;
199
199
200
- let relAssetPath = relative ( fileDir , assetDir ) ;
200
+ let relAssetPath = parseWinPath ( relative ( fileDir , assetDir ) ) ;
201
201
relAssetPath = join ( relAssetPath , `${ fileName . name } ${ fileName . ext } ` ) ;
202
202
return parseWinPath ( relAssetPath ) ;
203
203
}
Original file line number Diff line number Diff line change @@ -422,7 +422,7 @@ export class MediaHelpers {
422
422
423
423
// If the image exists in a content folder, the relative path needs to be used
424
424
if ( existsInContent ) {
425
- const relImgPath = relative ( fileDir , imgDir ) ;
425
+ const relImgPath = parseWinPath ( relative ( fileDir , imgDir ) ) ;
426
426
427
427
relPath = join ( relImgPath , basename ( relPath ) ) ;
428
428
Original file line number Diff line number Diff line change 1
1
import { dirname , relative } from 'path' ;
2
2
import { ContentFolder } from '../models' ;
3
+ import { parseWinPath } from './parseWinPath' ;
3
4
4
5
export const processPathPlaceholders = (
5
6
value : string ,
@@ -11,7 +12,7 @@ export const processPathPlaceholders = (
11
12
const relPathToken = '{{pathToken.relPath}}' ;
12
13
if ( value . includes ( relPathToken ) && contentFolder ?. path ) {
13
14
const dirName = dirname ( filePath ) ;
14
- const relPath = relative ( contentFolder . path , dirName ) ;
15
+ const relPath = parseWinPath ( relative ( contentFolder . path , dirName ) ) ;
15
16
value = value . replace ( relPathToken , relPath ) ;
16
17
}
17
18
You can’t perform that action at this time.
0 commit comments