File size: 2,392 Bytes
3402506
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Directory status checker for BytePlus Image Generation Studio
"""

import os
from pathlib import Path

def check_directory_status():
    """Check the status of all required directories"""
    print("πŸ” Directory Status Check")
    print("=" * 40)
    
    # Check main directories
    directories = {
        "Cache Directory": ".cache",
        "Generated Images": "Generated", 
        "Static Files": "static",
        "Session Viewer": "view_session"
    }
    
    for name, path in directories.items():
        path_obj = Path(path)
        
        print(f"\nπŸ“ {name}:")
        print(f"   Path: {path}")
        
        if path_obj.exists():
            if path_obj.is_symlink():
                target = path_obj.readlink()
                print(f"   Status: βœ… Symbolic link -> {target}")
            else:
                print(f"   Status: βœ… Directory exists")
            
            # Check permissions
            try:
                items = list(path_obj.iterdir())
                print(f"   Contents: {len(items)} items")
                if items:
                    print(f"   Sample: {[item.name for item in items[:3]]}")
                else:
                    print(f"   Contents: Empty")
            except PermissionError:
                print(f"   Status: ❌ Permission denied")
            except Exception as e:
                print(f"   Status: ⚠️ Error accessing: {e}")
        else:
            print(f"   Status: ❌ Does not exist")
    
    # Check cache directory permissions
    print(f"\nπŸ”’ Permissions Check:")
    cache_path = Path(".cache")
    if cache_path.exists():
        stat_info = cache_path.stat()
        permissions = oct(stat_info.st_mode)[-3:]
        print(f"   Cache directory permissions: {permissions}")
        if permissions == "755":
            print("   βœ… Permissions are correct")
        else:
            print("   ⚠️ Permissions may need adjustment")
    
    # Check if app is ready to run
    print(f"\nπŸš€ App Status:")
    app_file = Path(".cache/app.py")
    if app_file.exists():
        print("   βœ… App is downloaded and ready to run")
        print("   πŸ’‘ Use: python run_app.py")
    else:
        print("   ❌ App not downloaded yet")
        print("   πŸ’‘ Use: python app.py (to download first)")

if __name__ == "__main__":
    check_directory_status()