Skip to content

Conversation

@ManoloTonto1
Copy link

Add Windows and WSL Support for Arc Browser Data Access

Summary

This PR adds comprehensive support for Windows and Windows Subsystem for Linux (WSL) environments, enabling the Arc export script to automatically locate and process Arc Browser data on Windows systems.

Changes Made

🚀 New Features

  • WSL Detection: Automatically detects WSL environment by checking /proc/version for Microsoft signatures
  • Dynamic Username Resolution: Intelligently discovers Windows usernames through multiple fallback methods
  • Windows Path Translation: Seamlessly translates Windows paths to WSL mount points (/mnt/c/Users/...)
  • Enhanced Arc Package Discovery: Improved search patterns for Arc Browser installations with suffix handling (TheBrowserCompany.Arc_*)
  • New CLI Option: Added --find-arc flag to debug and verify Arc data path location

🔧 Improvements

  • Robust Error Handling: Enhanced error messages with OS-specific path guidance
  • Multi-Installation Support: Handles multiple Arc installations by selecting the most recently modified
  • Better Logging: Improved debug output with WSL-specific information
  • Cross-Platform Compatibility: Maintains existing macOS/Linux functionality while adding Windows support

📁 Path Resolution

The script now correctly handles Arc Browser data locations across platforms:

  • Windows: C:\Users\[USERNAME]\AppData\Local\Packages\TheBrowserCompany.Arc_*\LocalCache\Local\Arc\
  • WSL: /mnt/c/Users/[USERNAME]/AppData/Local/Packages/TheBrowserCompany.Arc_*/LocalCache/Local/Arc/
  • macOS/Linux: ~/Library/Application Support/Arc/

Technical Details

WSL Environment Detection

is_wsl = os.path.exists("/proc/version") and "microsoft" in open("/proc/version").read().lower()

Windows Username Discovery

The script attempts multiple methods to find the correct Windows username:

  1. Windows environment variables (if available in WSL)
  2. Current WSL username as fallback
  3. Directory scanning in /mnt/c/Users/ as last resort

Arc Package Pattern Matching

Enhanced search patterns to handle Arc's Windows package naming:

  • Primary: TheBrowserCompany.Arc_* (matches packages like TheBrowserCompany.Arc_ttt1ap7aakyb4)
  • Fallback: Any package starting with TheBrowserCompany.Arc

Testing

Tested on WSL2 Ubuntu with Arc Browser installed on Windows

  • Successfully detects WSL environment
  • Correctly identifies Windows username
  • Finds Arc package: TheBrowserCompany.Arc_ttt1ap7aakyb4
  • Processes 147 bookmarks across 4 spaces
  • Generates valid HTML export file

Usage Examples

Debug Arc Installation

python3 main.py --find-arc
# Output: Arc Data Path: /mnt/c/Users/[USERNAME]/AppData/Local/Packages/TheBrowserCompany.Arc_ttt1ap7aakyb4/LocalCache/Local/Arc/StorableSidebar.json
# ✓ File found

Export with Verbose Output

python3 main.py -v
# Shows detailed WSL detection and path resolution

Backward Compatibility

Fully backward compatible - all existing functionality for macOS and Linux remains unchanged

Error Handling

Enhanced error messages now provide platform-specific guidance:

Windows/WSL:

> File not found. Look for the "StorableSidebar.json" file within the Arc Browser data folder:
  Windows: "C:\Users\[USERNAME]\AppData\Local\Packages\TheBrowserCompany.Arc_*\LocalCache\Local\Arc\"
  WSL: "/mnt/c/Users/[USERNAME]/AppData/Local/Packages/TheBrowserCompany.Arc_*/LocalCache/Local/Arc/"

Future Considerations

  • Could potentially add support for other Windows package managers or installation methods
  • May benefit from caching discovered paths for performance in future runs

Fixes: Resolves Windows compatibility issues
Closes: #[issue-number] (if applicable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant