mirror of
https://github.com/labwc/labwc.git
synced 2025-11-05 13:29:58 -05:00
Add command line option -C to specify config directory
Also expand usage message to explain what each option means
This commit is contained in:
parent
d0b9680d00
commit
edc5338af4
8 changed files with 47 additions and 27 deletions
|
|
@ -14,7 +14,6 @@
|
|||
#include <wayland-server-core.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "action.h"
|
||||
#include "common/dir.h"
|
||||
#include "common/nodename.h"
|
||||
#include "common/string-helpers.h"
|
||||
#include "common/zfree.h"
|
||||
|
|
@ -626,10 +625,10 @@ post_processing(void)
|
|||
static void
|
||||
rcxml_path(char *buf, size_t len)
|
||||
{
|
||||
if (!strlen(config_dir())) {
|
||||
if (!rc.config_dir) {
|
||||
return;
|
||||
}
|
||||
snprintf(buf, len, "%s/rc.xml", config_dir());
|
||||
snprintf(buf, len, "%s/rc.xml", rc.config_dir);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "common/buf.h"
|
||||
#include "common/dir.h"
|
||||
#include "common/spawn.h"
|
||||
#include "common/string-helpers.h"
|
||||
|
||||
|
|
@ -73,24 +72,23 @@ read_environment_file(const char *filename)
|
|||
}
|
||||
|
||||
static const char *
|
||||
config_dir_append(const char *append)
|
||||
build_path(const char *dir, const char *filename)
|
||||
{
|
||||
const char *config = config_dir();
|
||||
if (string_empty(config) || string_empty(append)) {
|
||||
if (string_empty(dir) || string_empty(filename)) {
|
||||
return NULL;
|
||||
}
|
||||
int len = strlen(config) + strlen(append) + 2;
|
||||
int len = strlen(dir) + strlen(filename) + 2;
|
||||
char *buffer = calloc(len, 1);
|
||||
strcat(buffer, config);
|
||||
strcat(buffer, dir);
|
||||
strcat(buffer, "/");
|
||||
strcat(buffer, append);
|
||||
strcat(buffer, filename);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void
|
||||
session_environment_init(void)
|
||||
session_environment_init(const char *dir)
|
||||
{
|
||||
const char *environment = config_dir_append("environment");
|
||||
const char *environment = build_path(dir, "environment");
|
||||
if (!environment) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -99,9 +97,9 @@ session_environment_init(void)
|
|||
}
|
||||
|
||||
void
|
||||
session_autostart_init(void)
|
||||
session_autostart_init(const char *dir)
|
||||
{
|
||||
const char *autostart = config_dir_append("autostart");
|
||||
const char *autostart = build_path(dir, "autostart");
|
||||
if (!autostart) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue