Hi! I only found Daggerfall Unity a few hours ago, but I'm really excited by it. I've been playing around, trying to make it portable. Usually to do that when the game is looking for files in AppData, I create a batch file that temporarily changes the userprofile path while the game is running. It looks something like:
@echo off
set USERPROFILE=%__CD__%
start DaggerfallUnity.exe
That usually works, but Daggerfall Unity still looks for settings.ini in C:\Users... Is there some different environment variable it uses to look for the profile path? Running Windows 10.
How to reference user profile path?
- Interkarma
- Posts: 7247
- Joined: Sun Mar 22, 2015 1:51 am
Re: How to reference user profile path?
Hi welcome to the forums!
Path is sourced from Application.persistentDataPath property inside of Unity runtime.
https://docs.unity3d.com/ScriptReferenc ... aPath.html
I don't know that it will be possible to change this via environment variables.
Path is sourced from Application.persistentDataPath property inside of Unity runtime.
https://docs.unity3d.com/ScriptReferenc ... aPath.html
I don't know that it will be possible to change this via environment variables.
-
- Posts: 1
- Joined: Tue Oct 13, 2020 8:25 pm
Re: How to reference user profile path?
A little late to the game but I was wanting to keep my profile and settings in a local folder as well so here's a batch file I came up with to do that:
Just make sure if you already have "%userprofile%\appdata\locallow\Daggerfall Workshop" folder that you move it local to the daggerfall unity folder and create your batch file in the daggerfall unity installation folder (where you run daggerfallunity.exe from) and run it from there.
Quick explanation:
This creates a folder junction for the Daggerfall Workshop folder that's stored local to the users profile, to a copy of the folder that you place in the Daggerfall Unity installation folder.
A new 'junction' (which is like a link) is made in the "%userprofile%\appdata\locallow\" named "Daggerfall Workshop" so you have to make sure you move or delete the folder there (and make sure you have a backup if necessary, if a fresh install then you won't have to worry about it). The junctions work across hard drives which was important for me as I have my daggerfall installation on a different drive. It also allows the portability of a single folder for backup of your profile and settings and saves rather than having to go digging for things like screenshots or save backups.
If you want to delete the junction later you just delete ("%userprofile%\appdata\locallow\Daggerfall Workshop") deleting it there in the file browser just deletes the junction, it still remains wherever you linked it from.
My case is I have daggerfall unity installed in "e:\games\Daggerfall Unity" and I have inside that folder my "Daggerfall Workshop" folder and the batch file I created in inside the "e:\games\daggerfall unity" folder and I run that to start the game.
Code: Select all
@echo off
IF EXIST "%userprofile%\appdata\locallow\Daggerfall Workshop" (
start "" daggerfallunity.exe
) else (
mklink /j "%userprofile%\appdata\locallow\Daggerfall Workshop" "./Daggerfall Workshop"
start "" daggerfallunity.exe
)
Quick explanation:
This creates a folder junction for the Daggerfall Workshop folder that's stored local to the users profile, to a copy of the folder that you place in the Daggerfall Unity installation folder.
A new 'junction' (which is like a link) is made in the "%userprofile%\appdata\locallow\" named "Daggerfall Workshop" so you have to make sure you move or delete the folder there (and make sure you have a backup if necessary, if a fresh install then you won't have to worry about it). The junctions work across hard drives which was important for me as I have my daggerfall installation on a different drive. It also allows the portability of a single folder for backup of your profile and settings and saves rather than having to go digging for things like screenshots or save backups.
If you want to delete the junction later you just delete ("%userprofile%\appdata\locallow\Daggerfall Workshop") deleting it there in the file browser just deletes the junction, it still remains wherever you linked it from.
My case is I have daggerfall unity installed in "e:\games\Daggerfall Unity" and I have inside that folder my "Daggerfall Workshop" folder and the batch file I created in inside the "e:\games\daggerfall unity" folder and I run that to start the game.
- haloterm
- Posts: 391
- Joined: Sat Feb 16, 2019 5:21 am
Re: How to reference user profile path?
Thanks for this batch file, that was exactly what I needed!
(I don't know if you will read this, given this was your only post so far, but anyway I want to thank.)
Edit: To make this usable for keeping different installations of DFU separate, I changed the script as follows:
Code: Select all
@echo off
IF EXIST "%userprofile%\appdata\locallow\Daggerfall Workshop" (
rmdir /s /q "%userprofile%\appdata\locallow\Daggerfall Workshop"
mklink /j "%userprofile%\appdata\locallow\Daggerfall Workshop" "./Daggerfall Workshop"
start "" daggerfallunity.exe
) else (
mklink /j "%userprofile%\appdata\locallow\Daggerfall Workshop" "./Daggerfall Workshop"
start "" daggerfallunity.exe
)
I save this as startdfu.bat in the DFU folders. On my desktop, I then have normal starter shortcuts to the various startdfu.bats. Works perfectly.
So I can keep a pure vanilla install, a DREAM install and a "retro enhanced" install all separate and switch between them as I like. And it is good preparation for testing out DFU 0.13.0.