Skip to content

Commit

Permalink
[helper] Filepath: Added accessibility helper method
Browse files Browse the repository at this point in the history
Accessibility method helps identify whether a given save path directory is accessible for the user to write to.
  • Loading branch information
waaake committed Dec 23, 2024
1 parent aeb77d8 commit 9b96cfc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions meshroom/ui/components/filepath.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ def removeExtension(self, path):
""" Returns the pathname without its extension (.ext)"""
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(QUrl, result=bool)
def isFile(self, path):
Expand Down

0 comments on commit 9b96cfc

Please sign in to comment.