Spaces:
Sleeping
Sleeping
File size: 2,535 Bytes
02831c4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
#!/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) |