File size: 1,932 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
#!/bin/bash
# Targeted permission fix for specific folders only
# This script affects ONLY the directories you're interested in

echo "🎯 Fixing permissions for specific directories only..."
echo "Target directories: Generated, static, view_session"
echo "=================================================="

# Check if directories exist first
check_directory() {
    if [ -d "$1" ]; then
        current_perms=$(stat -f "%Mp%Lp" "$1" 2>/dev/null || stat -c "%a" "$1" 2>/dev/null)
        echo "πŸ“ $1 - Current permissions: $current_perms"
        return 0
    else
        echo "⚠️  $1 - Does not exist"
        return 1
    fi
}

fix_directory_permissions() {
    if [ -d "$1" ]; then
        echo "πŸ”§ Fixing permissions for: $1"
        
        # Fix directory permissions (755 = rwxr-xr-x)
        chmod 755 "$1"
        
        # Fix permissions for all contents recursively
        # Directories: 755, Files: 644
        find "$1" -type d -exec chmod 755 {} \; 2>/dev/null
        find "$1" -type f -exec chmod 644 {} \; 2>/dev/null
        
        echo "βœ… Fixed: $1"
    else
        echo "❌ Cannot fix: $1 (does not exist)"
    fi
}

echo "Current status:"
check_directory ".cache/Generated"
check_directory ".cache/static" 
check_directory ".cache/view_session"

echo ""
echo "Do you want to fix permissions for these directories? (y/N)"
read -r response

if [[ "$response" =~ ^[Yy]$ ]]; then
    echo ""
    echo "Applying permission fixes..."
    
    # Fix permissions for the actual directories in .cache
    fix_directory_permissions ".cache/Generated"
    fix_directory_permissions ".cache/static"
    fix_directory_permissions ".cache/view_session"
    
    echo ""
    echo "βœ… Permission fix complete!"
    echo ""
    echo "Final status:"
    check_directory ".cache/Generated"
    check_directory ".cache/static"
    check_directory ".cache/view_session"
else
    echo "Operation cancelled."
fi