Resolve special char "~" on Dialog Box's paths. "~" will be resolved to the user's home directory.
Example: Open a Dialog Box on the user's Documents folder with "~/Documents"
This commit is contained in:
parent
63c8dea9cd
commit
0ed8688be4
1 changed files with 10 additions and 1 deletions
|
|
@ -417,7 +417,16 @@ module.exports = {
|
|||
|
||||
var p = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME']
|
||||
|
||||
if (data.path) p = path.resolve(...data.path)
|
||||
if (data.path) {
|
||||
// Resolve '~' to user's home directory
|
||||
if (data.path[0].startsWith('~')) {
|
||||
p = data.path[0].replace( "~", p );
|
||||
}
|
||||
else {
|
||||
p = path.resolve(...data.path)
|
||||
}
|
||||
//console.log(`Resolved path: ${p}`);
|
||||
}
|
||||
|
||||
var root = settings.read('remote-root')
|
||||
if (root && !p.includes(root)) p = root
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue