mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 15:31:26 +12:00
PKG: Ask to user if he wants to install game shortcut on PKG installation
This commit is contained in:
parent
b7d80ab335
commit
0d126afb1f
6 changed files with 175 additions and 12 deletions
|
@ -66,7 +66,7 @@ namespace gui::utils
|
|||
[[maybe_unused]] const std::string& description,
|
||||
[[maybe_unused]] const std::string& src_icon_path,
|
||||
[[maybe_unused]] const std::string& target_icon_dir,
|
||||
bool is_desktop_shortcut)
|
||||
shortcut_location location)
|
||||
{
|
||||
if (name.empty())
|
||||
{
|
||||
|
@ -84,14 +84,21 @@ namespace gui::utils
|
|||
|
||||
std::string link_path;
|
||||
|
||||
if (is_desktop_shortcut)
|
||||
if (location == shortcut_location::desktop)
|
||||
{
|
||||
link_path = QStandardPaths::writableLocation(QStandardPaths::StandardLocation::DesktopLocation).toStdString();
|
||||
}
|
||||
else
|
||||
else if (location == shortcut_location::applications)
|
||||
{
|
||||
link_path = QStandardPaths::writableLocation(QStandardPaths::StandardLocation::ApplicationsLocation).toStdString();
|
||||
}
|
||||
#ifdef _WIN32
|
||||
else if (location == shortcut_location::rpcs3_shortcuts)
|
||||
{
|
||||
link_path = fs::get_config_dir() + "/games/shortcuts/";
|
||||
fs::create_dir(link_path);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!fs::is_dir(link_path))
|
||||
{
|
||||
|
@ -99,7 +106,7 @@ namespace gui::utils
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!is_desktop_shortcut)
|
||||
if (location == shortcut_location::applications)
|
||||
{
|
||||
link_path += "/RPCS3";
|
||||
|
||||
|
@ -197,7 +204,7 @@ namespace gui::utils
|
|||
res = pPersistFile->Save(w_link_file.c_str(), TRUE);
|
||||
if (FAILED(res))
|
||||
{
|
||||
if (is_desktop_shortcut)
|
||||
if (location == shortcut_location::desktop)
|
||||
{
|
||||
return cleanup(false, fmt::format("Saving file to desktop failed (%s)", str_error(res)));
|
||||
}
|
||||
|
@ -348,7 +355,7 @@ namespace gui::utils
|
|||
}
|
||||
shortcut_file.close();
|
||||
|
||||
if (is_desktop_shortcut)
|
||||
if (location == shortcut_location::desktop)
|
||||
{
|
||||
if (chmod(link_path.c_str(), S_IRWXU) != 0) // enables user to execute file
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue