Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Test script to verify symbolic links work for BytePlus directories | |
| """ | |
| import os | |
| from pathlib import Path | |
| def test_directory_access(): | |
| """Test that all required directories are accessible through symbolic links.""" | |
| print("π§ͺ Testing BytePlus directory access through symbolic links...") | |
| # Test directories | |
| test_dirs = [ | |
| ".cache/Generated", | |
| ".cache/static", | |
| ".cache/view_session", | |
| ".cache/static/css", | |
| ".cache/static/js", | |
| ".cache/static/images" | |
| ] | |
| all_passed = True | |
| for test_dir in test_dirs: | |
| dir_path = Path(test_dir) | |
| # Test directory existence | |
| if dir_path.exists(): | |
| print(f"β Directory exists: {test_dir}") | |
| else: | |
| print(f"β Directory missing: {test_dir}") | |
| all_passed = False | |
| continue | |
| # Test write permission | |
| try: | |
| test_file = dir_path / "test_write.tmp" | |
| test_file.write_text("test content") | |
| if test_file.read_text() == "test content": | |
| print(f"β Write/Read access: {test_dir}") | |
| test_file.unlink() # Clean up | |
| else: | |
| print(f"β Read verification failed: {test_dir}") | |
| all_passed = False | |
| except Exception as e: | |
| print(f"β Write access failed for {test_dir}: {e}") | |
| all_passed = False | |
| # Test symbolic link verification | |
| symlink_dirs = [".cache/Generated", ".cache/static", ".cache/view_session"] | |
| for symlink_dir in symlink_dirs: | |
| link_path = Path(symlink_dir) | |
| if link_path.is_symlink(): | |
| target = link_path.readlink() | |
| print(f"π Symlink verified: {symlink_dir} -> {target}") | |
| else: | |
| print(f"β οΈ Not a symlink: {symlink_dir}") | |
| all_passed = False | |
| if all_passed: | |
| print("\nπ All tests passed! Symbolic link approach is working correctly.") | |
| print("β BytePlus app will be able to access Generated/, static/, and view_session/ directories") | |
| print("β View session functionality should work properly") | |
| print("β File downloads will be stored in the correct directories") | |
| else: | |
| print("\nβ Some tests failed. Please check the directory setup.") | |
| return all_passed | |
| if __name__ == "__main__": | |
| success = test_directory_access() | |
| exit(0 if success else 1) |