Populate additional Config values, use company name and file name for preference path

This commit is contained in:
Joshua Granick
2015-03-19 14:16:31 -07:00
parent 057a1b082e
commit ea0db8f13f
6 changed files with 50 additions and 16 deletions

View File

@@ -559,9 +559,15 @@ namespace lime {
}
value lime_system_get_directory (value type) {
value lime_system_get_directory (value type, value company, value title) {
return alloc_string (System::GetDirectory ((SystemDirectory)val_int (type)));
const char* companyName = "";
const char* titleName = "";
if (!val_is_null (company)) companyName = val_string (company);
if (!val_is_null (title)) titleName = val_string (title);
return alloc_string (System::GetDirectory ((SystemDirectory)val_int (type), companyName, titleName));
}
@@ -764,7 +770,7 @@ namespace lime {
DEFINE_PRIM (lime_renderer_create, 1);
DEFINE_PRIM (lime_renderer_flip, 1);
DEFINE_PRIM (lime_render_event_manager_register, 2);
DEFINE_PRIM (lime_system_get_directory, 1);
DEFINE_PRIM (lime_system_get_directory, 3);
DEFINE_PRIM (lime_system_get_timer, 0);
DEFINE_PRIM (lime_text_layout_create, 3);
DEFINE_PRIM (lime_text_layout_position, 5);

View File

@@ -28,20 +28,18 @@
namespace lime {
const char* System::GetDirectory (SystemDirectory type) {
const char* System::GetDirectory (SystemDirectory type, const char* company, const char* title) {
switch (type) {
case APPLICATION:
// TODO: Need to get the user's company and title or package name
// previous behavior was the company + file
return SDL_GetPrefPath ("My Company", "My Awesome SDL 2 Game");
return SDL_GetBasePath ();
break;
case APPLICATION_STORAGE:
return SDL_GetBasePath ();
return SDL_GetPrefPath (company, title);
break;
case DESKTOP: {