简体   繁体   中英

How to copy files to home directory of the user

I want qmake to create a sub directory in /home for my own config files like /home/user/.myapp . But how can I get the home directory path in qmake?

QMake is a build system only available on the development machine at build time, and such won't help you to create directories on the machine where your software is deployed. To get storage locations at application runtime, use QStandardPaths (Qt 5) or QDesktopServices::storageLocation() (Qt 4). To get the user's home directory, use QDir::homePath() . Then simply create the required directories and files programmatically, in your program.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM