Ensures the workspace directory for a given username exists. Creates the directory if it doesn't exist.
(username: str)
| 19 | |
| 20 | # Utility function to get or create a user's workspace directory |
| 21 | def get_or_create_workspace(username: str) -> str: |
| 22 | """ |
| 23 | Ensures the workspace directory for a given username exists. |
| 24 | Creates the directory if it doesn't exist. |
| 25 | """ |
| 26 | workspace_path = os.path.join('./workspace/', username) |
| 27 | if not os.path.exists(workspace_path): |
| 28 | os.makedirs(workspace_path) |
| 29 | print(f"Created workspace for {username} at {workspace_path}") |
| 30 | return workspace_path |
| 31 | |
| 32 | |
| 33 | @file_router.get('/download/{username}') |
no outgoing calls
no test coverage detected