mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-24 07:08:07 +00:00
feat(ui/scripts/Utils/utils): basename/dirname supports windows paths
This commit is contained in:
parent
b84b29bdcf
commit
2ba8aa0d00
1 changed files with 11 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue