Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Make access optional

* Minor changes

* Update dependencies

* Check write access on correct dir
  • Loading branch information
DirtyRacer1337 authored Feb 23, 2023
1 parent 948d05b commit 28e33b9
Show file tree
Hide file tree
Showing 7 changed files with 600 additions and 596 deletions.
8 changes: 6 additions & 2 deletions namer/configuration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ def __verify_dir(config: NamerConfig, name: str, other_dirs: List[str]) -> bool:
"""
path_list = tuple(str(getattr(config, name)) for name in other_dirs if hasattr(config, name))
dir_name: Path = getattr(config, name) if hasattr(config, name) else None
if dir_name and (not dir_name.is_dir() or not os.access(dir_name, os.W_OK) or str(dir_name).startswith(path_list)):
logger.error("Configured directory {}: {} is not a directory or not accessible or in other watchdog directory", name, dir_name)
if dir_name and (not dir_name.is_dir() or str(dir_name).startswith(path_list)):
logger.error(f'Configured directory {name}: {dir_name} is not a directory or not exist or in other watchdog directory')

return False

if dir_name and not os.access(dir_name, os.W_OK):
logger.warning(f'Configured directory {name}: {dir_name} might have write permission problem')

return True


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"lodash": "^4.17.21"
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.20.2",
"babel-loader": "^9.1.2",
"copy-webpack-plugin": "^11.0.0",
Expand Down
Loading

0 comments on commit 28e33b9

Please sign in to comment.