SIDEL_ScriptsManager/check-windows-compatibility.sh

85 lines
2.7 KiB
Bash

#!/bin/bash
# Windows Compatibility Verification Script
# Run this script to check for Windows-incompatible files before committing
echo "🔍 Checking Windows compatibility..."
echo "======================================"
# Check for files with problematic characters
echo "Checking for files with Windows-problematic characters..."
# Files with colons
colon_files=$(find . -name "*:*" -type f 2>/dev/null | grep -v "\.git" || true)
if [ -n "$colon_files" ]; then
echo "❌ Found files with colons (problematic for Windows):"
echo "$colon_files"
exit 1
else
echo "✅ No files with colons found"
fi
# Files with other problematic characters
problematic_files=$(find . -name "*[<>|\"*?]*" -type f 2>/dev/null | grep -v "\.git" || true)
if [ -n "$problematic_files" ]; then
echo "❌ Found files with Windows-problematic characters:"
echo "$problematic_files"
exit 1
else
echo "✅ No files with problematic characters found"
fi
# Check for very long paths (Windows has 260 char limit)
echo "Checking for overly long file paths..."
long_paths=$(find . -type f 2>/dev/null | while read file; do
if [ ${#file} -gt 240 ]; then
echo "$file (${#file} chars)"
fi
done)
if [ -n "$long_paths" ]; then
echo "⚠️ Found long file paths (may cause Windows issues):"
echo "$long_paths"
echo "Consider shortening these paths"
else
echo "✅ All file paths are reasonable length"
fi
# Check .gitignore has Windows protection
echo "Checking .gitignore for Windows protection..."
if grep -q "Zone.Identifier" .gitignore; then
echo "✅ .gitignore includes Windows file protection"
else
echo "❌ .gitignore missing Windows file protection"
echo "Add these lines to .gitignore:"
echo "*:Zone.Identifier"
echo "*:*"
echo "desktop.ini"
echo "Thumbs.db"
echo "*.lnk"
exit 1
fi
# Check for case-sensitive naming conflicts
echo "Checking for case-sensitive naming conflicts..."
case_conflicts=$(find . -type f 2>/dev/null | sort -f | uniq -i -d)
if [ -n "$case_conflicts" ]; then
echo "❌ Found potential case-sensitive naming conflicts:"
echo "$case_conflicts"
echo "These files may conflict on case-insensitive Windows file systems"
exit 1
else
echo "✅ No case-sensitive naming conflicts found"
fi
# Summary
echo ""
echo "🎉 Windows Compatibility Check Complete!"
echo "======================================"
echo "✅ Repository is Windows-compatible"
echo "✅ Ready for cross-platform development"
echo ""
echo "Next steps for Windows developers:"
echo "1. See WINDOWS-DEVELOPMENT-GUIDE.md for setup instructions"
echo "2. Use WSL2 or Docker Desktop for development"
echo "3. Test on both Windows and Linux before committing"
echo ""