Move the config file names out as #define into avrdude.h
This commit is contained in:
parent
374861f62e
commit
6a87a110cc
|
@ -21,6 +21,13 @@
|
|||
#ifndef avrdude_h
|
||||
#define avrdude_h
|
||||
|
||||
#define SYSTEM_CONF_FILE "avrdude.conf"
|
||||
#if defined(WIN32NATIVE)
|
||||
#define USER_CONF_FILE "avrdude.rc"
|
||||
#else
|
||||
#define USER_CONF_FILE ".avrduderc"
|
||||
#endif
|
||||
|
||||
extern char * progname; /* name of program, for messages */
|
||||
extern char progbuf[]; /* spaces same length as progname */
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ static char *filename;
|
|||
void win_sys_config_set(char sys_config[PATH_MAX])
|
||||
{
|
||||
sys_config[0] = 0;
|
||||
|
||||
|
||||
/* Use Windows API call to search for the Windows default system config file.*/
|
||||
SearchPath(NULL, "avrdude.conf", NULL, PATH_MAX, sys_config, &filename);
|
||||
SearchPath(NULL, SYSTEM_CONF_FILE, NULL, PATH_MAX, sys_config, &filename);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,9 +42,9 @@ void win_sys_config_set(char sys_config[PATH_MAX])
|
|||
void win_usr_config_set(char usr_config[PATH_MAX])
|
||||
{
|
||||
usr_config[0] = 0;
|
||||
|
||||
|
||||
/* Use Windows API call to search for the Windows default user config file. */
|
||||
SearchPath(NULL, "avrdude.rc", NULL, PATH_MAX, usr_config, &filename);
|
||||
SearchPath(NULL, USER_CONF_FILE, NULL, PATH_MAX, usr_config, &filename);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
10
src/main.c
10
src/main.c
|
@ -708,7 +708,7 @@ int main(int argc, char * argv [])
|
|||
i = strlen(sys_config);
|
||||
if (i && (sys_config[i - 1] != '/'))
|
||||
strcat(sys_config, "/");
|
||||
strcat(sys_config, "../etc/avrdude.conf");
|
||||
strcat(sys_config, "../etc/" SYSTEM_CONF_FILE);
|
||||
sys_config[PATH_MAX - 1] = '\0';
|
||||
if (access(sys_config, F_OK) == 0) {
|
||||
sys_config_found = true;
|
||||
|
@ -720,7 +720,7 @@ int main(int argc, char * argv [])
|
|||
i = strlen(sys_config);
|
||||
if (i && (sys_config[i - 1] != '/'))
|
||||
strcat(sys_config, "/");
|
||||
strcat(sys_config, "avrdude.conf");
|
||||
strcat(sys_config, SYSTEM_CONF_FILE);
|
||||
sys_config[PATH_MAX - 1] = '\0';
|
||||
if (access(sys_config, F_OK) == 0) {
|
||||
sys_config_found = true;
|
||||
|
@ -736,7 +736,7 @@ int main(int argc, char * argv [])
|
|||
i = strlen(sys_config);
|
||||
if (i && (sys_config[i - 1] != '/'))
|
||||
strcat(sys_config, "/");
|
||||
strcat(sys_config, "avrdude.conf");
|
||||
strcat(sys_config, SYSTEM_CONF_FILE);
|
||||
#endif
|
||||
if (access(sys_config, F_OK) == 0) {
|
||||
sys_config_found = true;
|
||||
|
@ -751,7 +751,7 @@ int main(int argc, char * argv [])
|
|||
/*
|
||||
* USER CONFIG
|
||||
* -----------
|
||||
* Determine the location of '.avrduderc'. Nothing changed here.
|
||||
* Determine the location of '.avrduderc'.
|
||||
*/
|
||||
#if defined(WIN32NATIVE)
|
||||
win_usr_config_set(usr_config);
|
||||
|
@ -763,7 +763,7 @@ int main(int argc, char * argv [])
|
|||
i = strlen(usr_config);
|
||||
if (i && (usr_config[i - 1] != '/'))
|
||||
strcat(usr_config, "/");
|
||||
strcat(usr_config, ".avrduderc");
|
||||
strcat(usr_config, USER_CONF_FILE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue