LWC Posted March 10, 2012 Posted March 10, 2012 (edited) The Qt open source Kapow punch clock program uses QDir::homePath() to locate its data file: main.cpp (from Kapow's source code): QString path = QDir::homePath() + "/Application Data/GottCode/Kapow/"; So I hoped to portabilize it by making AutoIt use: EnvSet("USERPROFILE", "a local path") Alas, Kapow ignored it. I therefore looked at Qt's documentation: Quote QString QDir::homePath () [static] Returns the absolute path of the user's home directory. Under Windows this function will return the directory of the current user's profile. Typically, this is: C:/Users/Username If the directory of the current user's profile does not exist or cannot be retrieved, the following alternatives will be checked (in the given order) until an existing and available path is found: 1. The path specified by the USERPROFILE environment variable. ... Can AutoIt somehow make Kapow think that this folder "does not exist or cannot be retrieved" and therefore use %HOMEPATH% instead? If not, is there a Qt expert in here that wishes to update Kapow's source code (the author blogged and twitted that he went AWOL) to accept a "/data=[path]" command line parameter? P.S. Kapow does have a portable mode, but it's hardcoded for one path ("..kapowdata") which is a problem in a multi-user environment. Edited November 2, 2024 by LWC Secured links
ProgAndy Posted March 10, 2012 Posted March 10, 2012 (edited) If you need it only for Windows Vista +, then you could use the portable mode and a symlink (command: mklink /d) You could also try the EnvSet("HOMEPATH", ...) and then Run(...) Edited March 10, 2012 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes
LWC Posted March 10, 2012 Author Posted March 10, 2012 (edited) Thanks. However:I also need it for XP. But the symlink wouldn't work for multiple users anyway.As for the other suggestion:Alas, Kapow ignored it. I therefore looked at Qt's documentation: Edited March 10, 2012 by LWC
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now