Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move userdata from Documents to AppData for Windows installed version #1333

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OpenUtau.Core/Util/PathManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public PathManager() {
if (!IsInstalled) {
DataPath = exePath;
} else {
string dataHome = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string dataHome = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
DataPath = Path.Combine(dataHome, "OpenUtau");
}
CachePath = Path.Combine(DataPath, "Cache");
Expand Down
24 changes: 24 additions & 0 deletions OpenUtau.nsi
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
; Script generated by the HM NIS Edit Script Wizard.

ManifestDPIAware true

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "OpenUtau"
!define PRODUCT_PUBLISHER "stakira"
Expand Down Expand Up @@ -63,6 +65,7 @@ SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\OpenUtau.lnk" "$INSTDIR\OpenUtau.exe"
CreateShortCut "$DESKTOP\OpenUtau.lnk" "$INSTDIR\OpenUtau.exe"
SectionEnd

Section -Post
Expand All @@ -83,6 +86,26 @@ Section -Post
WriteRegStr HKCR "OpenUtauFile" "" "OpenUtau Sequence File"
WriteRegStr HKCR "OpenUtauFile\DefaultIcon" "" "$INSTDIR\OpenUtau.exe"
WriteRegStr HKCR "OpenUtauFile\shell\open\command" "" `"$INSTDIR\OpenUtau.exe" "%1"`

;move userdata from Documents to AppData upon update
IfFileExists "$DOCUMENTS\OpenUtau\prefs.json" 0 +18
CreateDirectory "$APPDATA\OpenUtau"
CopyFiles "$DOCUMENTS\OpenUtau\*" "$APPDATA\OpenUtau\"
CreateDirectory "$APPDATA\OpenUtau\Backups"
CopyFiles "$DOCUMENTS\OpenUtau\Backups\*" "$APPDATA\OpenUtau\Backups\"
CreateDirectory "$APPDATA\OpenUtau\Logs"
CopyFiles "$DOCUMENTS\OpenUtau\Logs\*" "$APPDATA\OpenUtau\Logs\"
CreateDirectory "$APPDATA\OpenUtau\Plugins"
CopyFiles "$DOCUMENTS\OpenUtau\Plugins\*" "$APPDATA\OpenUtau\Plugins\"
CreateDirectory "$APPDATA\OpenUtau\Singers"
CopyFiles "$DOCUMENTS\OpenUtau\Singers\*" "$APPDATA\OpenUtau\Singers\"
CreateDirectory "$APPDATA\OpenUtau\Resamplers"
CopyFiles "$DOCUMENTS\OpenUtau\Resamplers\*" "$APPDATA\OpenUtau\Resamplers\"
CreateDirectory "$APPDATA\OpenUtau\Templates"
CopyFiles "$DOCUMENTS\OpenUtau\Templates\*" "$APPDATA\OpenUtau\Templates\"
CreateDirectory "$APPDATA\OpenUtau\Wavtools"
CopyFiles "$DOCUMENTS\OpenUtau\Wavtools\*" "$APPDATA\OpenUtau\Wavtools\"
RMDir /r "$DOCUMENTS\OpenUtau"
SectionEnd

Section "VC Redist"
Expand All @@ -109,6 +132,7 @@ Section Uninstall
Delete "$INSTDIR\*"

Delete "$SMPROGRAMS\OpenUtau.lnk"
Delete "$DESKTOP\OpenUtau.lnk"

DeleteRegKey HKCR ".ustx"
DeleteRegKey HKCR "OpenUtauFile\DefaultIcon"
Expand Down
Loading