Vista compatibility - fuss over nothing?

Miscellaneous Forums/General Discussion/Vista compatibility - fuss over nothing?

Right - solution!

I've completely changed my angle of attack on this one. I figure that if we aren't able to modify user permissions programatically (for whatever reason), then another way might be to do it at install time.

In InnoSetup, its simply a case of adding the following to the script (I put it below the [Tasks] section, don't think it matters though):

[Dirs]
Name: "{commonappdata}\Your Company Name\Your Game Title"; Permissions: everyone-modify


In Vista, this creates a folder at "C:\ProgramData\Your Company Name\Your Game Title\". Permissions are set to 'everyone', and all users can create/read/write/modify anything in that folder, since permissions for all created files are inherited from the parent folder.

[edit] If your users might need to delete files too, then non-owners will need full access instead:
[Dirs]
Name: "{commonappdata}\Your Company Name\Your Game Title"; Permissions: everyone-full


[/edit]

Also tested this under XP and all is well.

From Blitzmax, use the code below to find the common application data path, then tack your company name and game title onto the end, so that you're accessing the same folder which your installer created:
Extern "Win32"
Function SHGetSpecialFolderLocation(hwndOwner, nFolder, pIdl:Byte  Ptr)
Function SHGetPathFromIDList( pidList ,lpBuffer:Byte  Ptr)
End Extern


Const CSIDL_COMMON_APPDATA = $23

Company:string = "Games Company"
Title:string = "Game Title"

Global dataPath:string = GetSpecialFolder(CSIDL_COMMON_APPDATA) + Company + "" + Title + ""

Function GetSpecialFolder:String(folder_id) 
Local  idl% = CreateBank (8) 
Local  pathbank:TBank = CreateBank (260) 
	If SHGetSpecialFolderLocation(0,folder_id,BankBuf(idl)) = 0		
		SHGetPathFromIDList PeekInt( idl,0), BankBuf(pathbank)
		Return String.FromCString(pathbank.Buf()) + ""
	EndIf
End Function