feat(ui/scripts/Utils/utils): basename/dirname supports windows paths

This commit is contained in:
Ronan Abhamon 2017-06-07 14:16:01 +02:00
parent b84b29bdcf
commit 2ba8aa0d00

View file

@ -179,7 +179,7 @@ function getUriFromSystemPath (path) {
var os = Qt.platform.os
if (os === 'windows' || os === 'winrt') {
return 'file://' + (/^[^:]+:/.exec(path) ? '' : '/')
return 'file://' + (/^\w:/.exec(path) ? '/' : '') + path
}
return 'file://' + path
@ -284,6 +284,11 @@ function assert (condition, message) {
// -----------------------------------------------------------------------------
function basename (str) {
var os = Qt.platform.os
if (os === 'windows' || os === 'winrt') {
str = str.replace(/\\/g, '/')
}
var str2 = str
var length = str2.length - 1
@ -303,6 +308,11 @@ function capitalizeFirstLetter (str) {
// -----------------------------------------------------------------------------
function dirname (str) {
var os = Qt.platform.os
if (os === 'windows' || os === 'winrt') {
str = str.replace(/\\/g, '/')
}
var str2 = str
var length = str2.length - 1