seafile-server/server/fileserver-config.c
feiniks 50882b41f4
Regularly cleanup files in the httptemp directory (#343)
* Regularly cleanup files in the httptemp directory

* Add scan http temp dir default configuration

* Fix mem leak for scan httptemp dir

* Modify int to gint64
2020-05-20 18:36:38 +08:00

42 lines
1.1 KiB
C

#include "common.h"
#include <glib.h>
#include "fileserver-config.h"
const char *OLD_GROUP_NAME = "httpserver";
const char *GROUP_NAME = "fileserver";
static const char *
get_group_name(GKeyFile *config)
{
return g_key_file_has_group (config, GROUP_NAME) ? GROUP_NAME : OLD_GROUP_NAME;
}
int
fileserver_config_get_integer(GKeyFile *config, char *key, GError **error)
{
const char *group = get_group_name(config);
return g_key_file_get_integer (config, group, key, error);
}
int
fileserver_config_get_int64(GKeyFile *config, char *key, GError **error)
{
const char *group = get_group_name(config);
return g_key_file_get_int64 (config, group, key, error);
}
char *
fileserver_config_get_string(GKeyFile *config, char *key, GError **error)
{
const char *group = get_group_name(config);
return g_key_file_get_string (config, group, key, error);
}
gboolean
fileserver_config_get_boolean(GKeyFile *config, char *key, GError **error)
{
const char *group = get_group_name(config);
return g_key_file_get_boolean (config, group, key, error);
}