diff options
author | louie <lshprung@yahoo.com> | 2020-12-23 18:20:46 -0800 |
---|---|---|
committer | louie <lshprung@yahoo.com> | 2020-12-23 18:20:46 -0800 |
commit | f9227cef5bcbe9f3a3fe3487ed1cc358cff37932 (patch) | |
tree | 5a009fd6587f075c5a48a9b8c665347ed151507e /read_cfg.c | |
parent | fa8e3992ef7060168770ccccabdfe3b2982ea700 (diff) |
Fixed Windows configuration auto-generation, added new setLauncherRaw option
Diffstat (limited to 'read_cfg.c')
-rw-r--r-- | read_cfg.c | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -12,7 +12,7 @@ #include "group.h" #define BUF_LEN 1024 //maybe move this line to the header file #define MAX_ARGS 5 -#define OPTION_CNT 13 +#define OPTION_CNT 14 //public #if defined _WIN32 || defined _WIN64 @@ -135,7 +135,8 @@ void cfg_interp(char *path){ options[9] = "hideFile"; options[10] = "setFlags"; options[11] = "setLauncher"; - options[12] = "sort"; + options[12] = "setLauncherRaw"; + options[13] = "sort"; //Read each line of "config" while(fgets(buffer, BUF_LEN, fp)){ @@ -240,22 +241,19 @@ void mkconfig_wizard(char *path){ exit(1); } - //write to file (in Windows, launch an application with the default launcher by invoking "start") - //FIXME at the moment, this WILL NOT WORK. I need to add an option to set launcher without quotes + //write to file (in Windows, executing a file will open it in its default application) #if defined _WIN32 || defined _WIN64 fprintf(fp, "# This file was auto-generated by tml. See docs/tml-config.md or tml-config(5) for documentation\n" - "# Please note that the launcher \"start\" is a built-in Windows command to launch a file with the default application\n\n" + "# By default, no launcher is specified for any group. When no launcher is specified on the Windows build of tml, media files will be opened with their default application.\n" + "# It is generally recommended to specify a launcher for groups containing media files using the \"setLauncher\" command\n\n" "# Recursively add files from %s%cMusic%c to Music group\n" "addGroup Music\n" - "setLauncher Music start\n" "addR %s%cMusic%c* Music\n\n" "# Recursively add files from %s%cPictures%c to Pictures group\n" "addGroup Pictures\n" - "setLauncher Pictures start\n" "addR %s%cPictures%c* Pictures\n\n" "# Recursively add files from %s%cVideos%c to Videos group\n" "addGroup Videos\n" - "setLauncher Videos start\n" "addR %s%cVideos%c* Videos", home, sep, sep, home, sep, sep, home, sep, sep, home, sep, sep, home, sep, sep, home, sep, sep); #else fprintf(fp, "# This file was auto-generated by tml. See docs/tml-config.md or tml-config(5) for documentation\n" @@ -459,6 +457,7 @@ void check_line(char *buffer, char **options, int ln){ break; case 11: //setLauncher + case 12: //setLauncherRaw //args[1] is referring to a group g = get_groups(); g_count = get_gcount(); @@ -470,7 +469,10 @@ void check_line(char *buffer, char **options, int ln){ //set a group's launcher (this requires pulling down the existing groups and finding the one that args[1] mentions) //assert that a matching group was found - if(i < g_count) set_gprog(g[i], strip_quotes(args[2])); + if(i < g_count){ + set_gprog(g[i], strip_quotes(args[2])); + if(search_res == 12) set_gquotes(g[i], false); //FIXME don't forget to change this line if adding more options!!! + } else{ error_p = malloc(sizeof(char) * 1024); sprintf(error_p, "Group \"%s\" does not exist", args[1]); @@ -479,7 +481,7 @@ void check_line(char *buffer, char **options, int ln){ } break; - case 12: //sort + case 13: //sort if(!(strcmp(args[1], "on"))) sort = true; else if(!(strcmp(args[1], "off"))) sort = false; break; |