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)