Exemple #1
0
void initialize_config(libconfig::Config& configuration)
{
    tstring environment_path = sx_config_path();
    tpath config_path = environment_path.empty() ?
        tpath(home_directory()) / L".sx.cfg" :
        tpath(environment_path);
    set_config_path(configuration, config_path.generic_string().c_str());
}
Exemple #2
0
static int
interpret(string_list_ty *result, const string_list_ty *arg,
    const expr_position_ty *pp, const struct opcode_context_ty *ocp)
{
    string_ty       *s;
    size_t          j;
    struct passwd   *pw;

    trace(("home\n"));
    (void)ocp;
    if (arg->nstrings < 2)
    {
        const char      *cp;

        cp = home_directory();
        assert(cp);
        s = str_from_c(cp);
        string_list_append(result, s);
        str_free(s);
        return 0;
    }
    for (j = 1; j < arg->nstrings; ++j)
    {
        s = arg->string[j];
        pw = getpwnam(s->str_text);
        if (!pw)
        {
            sub_context_ty  *scp;

            scp = sub_context_new();
            sub_var_set_string(scp, "Name", s);
            error_with_position(pp, scp, i18n("user \"$name\" unknown"));
            sub_context_delete(scp);
            return -1;
        }
        s = str_from_c(pw->pw_dir);
        string_list_append(result, s);
        str_free(s);
    }
    return 0;
}
std::string application_user_state_directory(const std::string &application_name) {
  return home_directory() + "/usr/local" + application_name;
}
std::string application_user_state_directory(const std::string &application_name) {
  return home_directory() + "/Library/Application Support/" + application_name;
}
std::string application_user_state_directory(const std::string &application_name) {
  return home_directory() + "/Application Data/" + application_name;
}