1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Desktop: Allow selecting editor path with dialog window

This commit is contained in:
Laurent Cozic
2019-01-30 19:19:06 +00:00
parent bda3ea9a35
commit cc8f8fcd2c
5 changed files with 185 additions and 15 deletions

View File

@ -123,6 +123,19 @@ function wrap(text, indent, width) {
});
}
function commandArgumentsToString(args) {
let output = [];
for (let i = 0; i < args.length; i++) {
let arg = args[i];
const quote = arg.indexOf('"') >= 0 ? "'" : '"';
if (arg.indexOf(' ') >= 0) {
arg = quote + arg + quote;
}
output.push(arg);
}
return output.join(' ');;
}
function splitCommandString(command, options = null) {
options = options || {};
if (!('handleEscape' in options)) {
@ -252,6 +265,6 @@ function scriptType(s) {
}
module.exports = Object.assign(
{ removeDiacritics, escapeFilename, wrap, splitCommandString, padLeft, toTitleCase, urlDecode, escapeHtml, surroundKeywords, scriptType },
{ removeDiacritics, escapeFilename, wrap, splitCommandString, padLeft, toTitleCase, urlDecode, escapeHtml, surroundKeywords, scriptType, commandArgumentsToString },
stringUtilsCommon,
);