Reputation: 9859
How I can extract file baseName from full file URL?
FileDialog
{
id: fileDialog
title: "Oooopen"
onAccepted:
{
console.log(fileUrl)
}
}
fileUrl
do not have properties like baseName
I tried to googling, but without success
Upvotes: 3
Views: 4312
Reputation: 5336
You could define your own basename
function
function basename(str)
{
return (str.slice(str.lastIndexOf("/")+1))
}
FileDialog
{
id: fileDialog
title: "Oooopen"
onAccepted:
{
console.log(basename(fileUrl.toString()))
}
}
Upvotes: 5