Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
vor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
oops, have to check all 9 buckets.
[vor.git]
/
file.c
diff --git
a/file.c
b/file.c
index
b9bc7e2
..
45532d3
100644
(file)
--- a/
file.c
+++ b/
file.c
@@
-16,9
+16,6
@@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "config.h"
-#include "file.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@
-26,12
+23,16
@@
#include <sys/types.h>
#include <unistd.h>
#include <sys/types.h>
#include <unistd.h>
+#include "common.h"
+#include "config.h"
+#include "file.h"
+
char *g_data_dir;
char *g_score_file;
char *g_data_dir;
char *g_score_file;
-mode_t g_score_mode;
+mode_t g_score_mask;
char *
char *
-load_file(char *filename)
+add_path(char *filename)
{
static char r[MAX_PATH_LEN];
snprintf(r, MAX_PATH_LEN, "%s/%s", g_data_dir, filename);
{
static char r[MAX_PATH_LEN];
snprintf(r, MAX_PATH_LEN, "%s/%s", g_data_dir, filename);
@@
-61,10
+62,11
@@
find_data_dir(void)
char *data_options[3] = {
"./data",
getenv("VOR_DATA"),
char *data_options[3] = {
"./data",
getenv("VOR_DATA"),
- "/usr/share/vor"
+ DATA_PREFIX
};
for(i=0; i<3; i++) {
};
for(i=0; i<3; i++) {
+ if(!data_options[i]) continue;
g_data_dir = strdup(data_options[i]);
if(is_dir(g_data_dir)) return true;
}
g_data_dir = strdup(data_options[i]);
if(is_dir(g_data_dir)) return true;
}
@@
-79,14
+81,10
@@
find_data_dir(void)
int
find_score_file(void)
{
int
find_score_file(void)
{
- g_score_file = load_file("scores");
- g_score_mode = 0111;
- if(is_file(g_score_file)) return true;
-
g_score_file = malloc(MAX_PATH_LEN);
snprintf(g_score_file, MAX_PATH_LEN,
g_score_file = malloc(MAX_PATH_LEN);
snprintf(g_score_file, MAX_PATH_LEN,
- "%s/.vor-high", getenv("HOME"));
- g_score_mode = 0177;
+ "%s/.vor-scores", getenv("HOME"));
+ g_score_mask = 0177;
if(is_file(g_score_file)) return true;
return false;
if(is_file(g_score_file)) return true;
return false;
@@
-109,7
+107,7
@@
open_score_file(char *mode)
if(!g_score_file) return f;
if(!g_score_file) return f;
- old_mask = umask(g_score_mode);
+ old_mask = umask(g_score_mask);
f = fopen(g_score_file, mode);
umask(old_mask);
f = fopen(g_score_file, mode);
umask(old_mask);