Skip to content

gustavodower/onedrive-mapper

Repository files navigation

OneDrive Drive Mapper

OneDrive Drive Mapper

A small Windows tray app that maps a drive letter (e.g. P:) to a folder inside your OneDrive, so cloud-synced tools that store absolute paths (Civil 3D data shortcuts, Revit links, etc.) stop breaking on per-user username differences.


The problem

Tools like Autodesk Civil 3D store absolute file paths inside their data shortcut XML files. When your projects live in OneDrive, that path includes your Windows username:

C:\Users\<YOU>\OneDrive - Company\Project\…

Anyone else on the team opening the same project sees broken references because their path is C:\Users\<THEM>\OneDrive - Company\Project\…. Teams end up re-pathing shortcuts constantly. This is a well-known issue on the Autodesk forums without a great fix.

The fix

This app maps a uniform drive letter (e.g. P:) to a folder inside your OneDrive on every teammate's machine, using Windows' built-in subst command. After setup, every team member sees the exact same path:

P:\Project\…

Your shortcuts record P:\… instead of C:\Users\<name>\…, and everyone's copy resolves correctly without manual repair.

Works with any cloud-synced OneDrive path — not just Civil 3D. Useful for Revit links, shared template libraries, or anywhere a Windows app records absolute paths.

How it works

  1. Reads your OneDrive accounts from the Windows registry (HKCU\Software\Microsoft\OneDrive\Accounts).
  2. You pick which OneDrive to use (personal / work / any specific tenant).
  3. You configure mappings (letter + folder) through the built-in GUI.
  4. The app runs subst P: "…folder…" at every Windows login automatically.
  5. The mapping config lives at .onedrive-mappings.json inside your OneDrive root — share it with your team and everyone gets identical drive letters.

The selection is persisted by OneDrive tenant ID, so swapping accounts or having multiple work accounts on the same PC keeps working correctly.

Features

  • Auto-detects all OneDrive accounts on the machine (personal + any number of work/school)
  • Portuguese and English UI (auto-detect + manual toggle)
  • Runs at Windows login automatically (HKCU\…\Run)
  • Inline folder picker — no manual JSON editing required
  • Team-shareable config (lives inside OneDrive, syncs automatically)
  • Single self-contained executable (~50 MB, .NET 10)

Install

Option A — Download the binary

Grab OneDriveMapper.exe from the latest release and double-click. Windows SmartScreen will warn "Windows protected your PC" on first run because the binary is unsigned — click More info → Run anyway.

Option B — Build from source

Requires the .NET 10 SDK.

git clone https://github.com/gustavodower/onedrive-mapper
cd onedrive-mapper
dotnet publish -c Release -o dist
# → dist\OneDriveMapper.exe

Usage

  1. Run OneDriveMapper.exe. On first launch, a picker shows all OneDrive accounts on your PC. Pick the one containing the folder you want to map.
  2. The mapping editor opens automatically. The first row is pre-filled with P: → OneDrive root. Click Change folder… to narrow it to a specific subfolder, or hit Save immediately to map the whole OneDrive.
  3. The drive appears in File Explorer. The app adds itself to Windows startup, so the mapping is re-applied every login.
  4. Right-click the tray icon any time to edit mappings, change accounts, toggle language, or exit.

Config file format

For scripted deployment or team distribution, drop a JSON at the root of your OneDrive:

{
  "mappings": [
    { "driveLetter": "P", "relativePath": "" },
    { "driveLetter": "M", "relativePath": "Projects/Acme" }
  ]
}
  • driveLetter — any A-Z letter except C.
  • relativePath — path inside the OneDrive root. Leave empty "" to map the OneDrive root itself.

The app reads this file on each run. Since it lives inside OneDrive, it syncs to every teammate automatically — edit it once, everyone picks up the change.

Why not just symlinks / junctions?

Symlinks and directory junctions into cloud-synced folders cause OneDrive sync weirdness. subst is a purely virtual drive letter that doesn't involve the filesystem — safe, transparent, and reversible.

FAQ

Does it modify my files? No. It only creates a virtual drive letter pointing at an existing folder. Zero file operations.

Does it work without OneDrive? The app finds folders via the OneDrive registry entries, so an OneDrive account is needed to pick the base folder. After that, subst itself doesn't care — it just needs a local path.

What about file locking / simultaneous edits? Not solved by this tool. OneDrive doesn't lock files while users are editing them; if two teammates open the same file, conflict copies can happen. Coordinate via chat, or move to a platform with native locking (ACC, Egnyte, SharePoint with check-out).

How do I uninstall? Right-click the tray icon → Exit. Delete the .exe. Remove the autostart entry from HKCU\Software\Microsoft\Windows\CurrentVersion\Run if you want to be thorough.

License

MIT — do whatever you want with it.

About

Windows tray app that substs a drive letter (P:) to a folder in OneDrive — fixes Civil 3D data shortcuts, Revit links, and similar tools that break on per-user username paths.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages