mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-30 23:08:25 +02:00
[helper] Filepath: Added accessibility helper method
Accessibility method helps identify whether a given save path directory is accessible for the user to write to.
This commit is contained in:
parent
aeb77d8dbc
commit
9b96cfcc99
1 changed files with 7 additions and 0 deletions
|
@ -57,6 +57,13 @@ class FilepathHelper(QObject):
|
||||||
""" Returns the pathname without its extension (.ext)"""
|
""" Returns the pathname without its extension (.ext)"""
|
||||||
return os.path.splitext(self.asStr(path))[0]
|
return os.path.splitext(self.asStr(path))[0]
|
||||||
|
|
||||||
|
@Slot(str, result=bool)
|
||||||
|
@Slot(QUrl, result=bool)
|
||||||
|
def accessible(self, path):
|
||||||
|
""" Returns whether a path is accessible for the user """
|
||||||
|
path = self.asStr(path)
|
||||||
|
return os.path.isdir(self.asStr(path)) and os.access(path, os.R_OK) and os.access(path, os.W_OK)
|
||||||
|
|
||||||
@Slot(str, result=bool)
|
@Slot(str, result=bool)
|
||||||
@Slot(QUrl, result=bool)
|
@Slot(QUrl, result=bool)
|
||||||
def isFile(self, path):
|
def isFile(self, path):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue