diff --git a/pros/conductor/conductor.py b/pros/conductor/conductor.py index ebe3f43a..35360770 100644 --- a/pros/conductor/conductor.py +++ b/pros/conductor/conductor.py @@ -215,6 +215,10 @@ def remove_template(project: Project, identifier: Union[str, BaseTemplate], remo def new_project(self, path: str, no_default_libs: bool = False, **kwargs) -> Project: if Path(path).exists() and Path(path).samefile(os.path.expanduser('~')): raise dont_send(ValueError('Will not create a project in user home directory')) + for char in str(Path(path)): + if char in ['/', '?', '<', '>', '\\', ':', '*', '|', '^', '#', '%', '&', '$', '+', '!', '`', '\'', '=', + '@', '\'', '{', '}', '[', ']', '(', ')', '~'] or ord(char) > 127: + raise dont_send(ValueError(f'Invalid character found in directory name: \'{char}\'')) proj = Project(path=path, create=True) if 'target' in kwargs: proj.target = kwargs['target']