You are here

A useful bit of code . . .

OliverK's picture
Submitted by OliverK on September 29, 2008 - 6:22pm
		;=== Check for data files
		IfFileExists "$PROGRAMDIRECTORY\config.conf" GetPassedParameters ;=== settings already in program directory
		IfFileExists "$SETTINGSDIRECTORY\config.conf" MoveSettings ;=== settings found in data directory
		;=== Copy the default settings files
		StrCmp $DEFAULTLOCATION "true" "" GetPassedParameters ;=== if not default location, user is on their own
		CreateDirectory "$SETTINGSDIRECTORY"
		CopyFiles /SILENT "$EXEDIR\App\DefaultData\settings\*.*" "$SETTINGSDIRECTORY\"
		;${StrReplace} $0 '\' '/' '$PROGRAMDIRECTORY\bin\ffmpeg.exe' ;you don't usually need these, unless the app is . . .  funny :D
		;${StrReplace} $1 '/' '\\' '$FFMPEGPATH'
		${ConfigWrite} "$SETTINGSDIRECTORY\config.conf" "ffmpegLibLocation=" "$FFMPEGPATH" $R0
		${GetRoot} $EXEDIR $0
		${DirState} "$0\Documents\Videos\" $VIDEOEXIST
		StrCmp $VIDEOEXIST "-1" SetAtRoot SetAtVideos
                                   ${ConfigWrite} "$SETTINGSDIRECTORY\config.conf" "downloadDir=" '$0\\Documents\\Videos\\' $R0
                                   Goto MoveSettings
                                  ${ConfigWrite} "$SETTINGSDIRECTORY\config.conf" "downloadDir=" '$0\\' $R0

You'll need to include the macros for GetRoot, DirStat, ConfigWrite, and StrReplace.

You could use this any application . . . Such as setting up a defualt location in a app. . . Like HM NIS Edit . . . Or like I did in this app, posted here:


TaffinFoxcroft's picture

Nice. I think first I'll get around to merging MenuLauncher and mkshortcuts, but then integrating this into HM NIS Edit Portable will be top priority.

But there’s no sense crying over every mistake,
You just keep on trying till you run out of cake.

OliverK's picture

Sweet, I was hoping it would help Biggrin

Too many lonely hearts in the real world
Too many bridges you can burn
Too many tables you can't turn
Don't wanna live my life in the real world