Added additional files for default setup.

Fixed executable to path variable expansion for the launcher.
Added default launcher for Main menu. Just add .bat, .exe, or .sh programs/scripts to your Main's roms directory to add functionality like Kodi, Shutdown, etc.
This commit is contained in:
Pieter Hulshoff 2016-07-26 15:33:28 +02:00
parent 1cfdea1b87
commit 83e149a1f2
9 changed files with 21 additions and 14 deletions

View File

@ -1,14 +1,20 @@
###############################################################################
# This main collection is intended to be a menu for navigating to other
# collections (although this can also be configured to list and launch items).
# See Menu.xml to configure the menu
# See menu.txt to configure the menu
###############################################################################
###############################################################################
# If a menu.xml file exists, it will display the menu alphabetically. To
# not auto-sort the menu items alphabetically, set the following to false.
# This does not apply to how your ROMs are sorted.
# Extensions are comma separated without spaces
###############################################################################
list.menuSort = true
list.extensions = exe,bat,sh
###############################################################################
# Sort menu items alphabetically
###############################################################################
list.menuSort = yes
###############################################################################
# The executable to run when an item in a collection item is selected
###############################################################################
launcher = Main

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,2 @@
executable = %ITEM_FILEPATH%
arguments =

View File

@ -42,12 +42,11 @@ bool Launcher::run(std::string collection, Item *collectionItem)
std::string executablePath;
std::string selectedItemsDirectory;
std::string selectedItemsPath;
std::string currentDirectory;
std::string extensionstr;
std::string matchedExtension;
std::string args;
if(!launcherExecutable(executablePath, currentDirectory, launcherName))
if(!launcherExecutable(executablePath, launcherName))
{
Logger::write(Logger::ZONE_ERROR, "Launcher", "Failed to find launcher executable (launcher: " + launcherName + " executable: " + executablePath + ")");
return false;
@ -85,6 +84,11 @@ bool Launcher::run(std::string collection, Item *collectionItem)
selectedItemsDirectory,
collection);
std::string currentDirectoryKey = "launchers." + launcherName + ".currentDirectory";
std::string currentDirectory = Utils::getDirectory(executablePath);
config_.getProperty(currentDirectoryKey, currentDirectory);
currentDirectory = replaceVariables(currentDirectory,
selectedItemsPath,
collectionItem->name,
@ -222,7 +226,7 @@ bool Launcher::launcherName(std::string &launcherName, std::string collection)
bool Launcher::launcherExecutable(std::string &executable, std::string &currentDirectory, std::string launcherName)
bool Launcher::launcherExecutable(std::string &executable, std::string launcherName)
{
std::string executableKey = "launchers." + launcherName + ".executable";
@ -231,11 +235,6 @@ bool Launcher::launcherExecutable(std::string &executable, std::string &currentD
return false;
}
std::string currentDirectoryKey = "launchers." + launcherName + ".currentDirectory";
currentDirectory = Utils::getDirectory(executable);
config_.getProperty(currentDirectoryKey, currentDirectory);
return true;
}

View File

@ -34,7 +34,7 @@ private:
const std::string &replace);
bool launcherName(std::string &launcherName, std::string collection);
bool launcherExecutable(std::string &executable, std::string &currentDirectory, std::string launcherName);
bool launcherExecutable(std::string &executable, std::string launcherName);
bool launcherArgs(std::string &args, std::string launcherName);
bool extensions(std::string &extensions, std::string launcherName);
bool collectionDirectory(std::string &directory, std::string collection);