File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ export class DefaultConfigValues {
2525 }
2626
2727 public static getDefaultRemotePath ( ) : string {
28- if ( os . platform ( ) === 'win32' ) {
29- return "" ;
28+ if ( Prefs . isRemoteScenario ( ) ) {
29+ return vsUtils . getRemotePathFromSftpConfig ( ) ;
3030 } else {
3131 return vsUtils . getProjectDirByOpenedFile ( ) . fsPath ;
3232 }
Original file line number Diff line number Diff line change @@ -48,3 +48,18 @@ export function getTextEditor(): vs.TextEditor | undefined {
4848 }
4949 return undefined ;
5050}
51+
52+ export function getRemotePathFromSftpConfig ( ) : string {
53+ let workspaceFolder = vs . workspace . workspaceFolders ?. [ 0 ] . uri . fsPath ;
54+ if ( workspaceFolder ) {
55+ let sftpConfigPath = pathUtils . fsJoin ( workspaceFolder , '.vscode' , 'sftp.json' ) ;
56+ if ( fs . existsSync ( sftpConfigPath ) ) {
57+ let rawData = fs . readFileSync ( sftpConfigPath ) ;
58+ let configJson = JSON . parse ( rawData . toString ( ) ) ;
59+ if ( configJson . remotePath ) {
60+ return configJson . remotePath ;
61+ }
62+ }
63+ }
64+ return "" ;
65+ }
You can’t perform that action at this time.
0 commit comments