diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-03-08 20:19:05 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-03-08 20:19:05 +0000 |
| commit | da85e88878251f6a980fef95bd47109169a3cf7c (patch) | |
| tree | 83b8b61c4afad0f6ccbb7940176a03f3ad4d2dc5 /src/homeDirector.c | |
| parent | f8bc51b580a5b9a8445f38b614a87209c074143a (diff) | |
- hra si vytvara domovskt adresar
- moznost ulozit konfiguraciu
- lasserove streli boli lepsie posunute
git-svn-id: http://opensvn.csie.org/tuxanci_ng@12 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/homeDirector.c')
| -rwxr-xr-x | src/homeDirector.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/homeDirector.c b/src/homeDirector.c new file mode 100755 index 0000000..e90caae --- /dev/null +++ b/src/homeDirector.c @@ -0,0 +1,42 @@ + +#include "main.h" +#include "homeDirector.h" + +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <assert.h> +#include <sys/stat.h> + +static char homeDirector[STR_PATH_SIZE]; + +void createHomeDirector() +{ + char *envHome; + + envHome = getenv("HOME"); + + if( envHome == NULL ) + { + fprintf(stderr, "Environment HOME not found !\n"); + exit(0); + } + + sprintf(homeDirector, "%s/%s", envHome, HOMEDIRECTOR_NAME); + + if ( access(homeDirector, F_OK) != 0 ) + { + printf("Create home director %s\n", homeDirector); + + if( mkdir(homeDirector, 0755) != 0 ) + { + fprintf(stderr, "Can't create home directory!\n"); + exit(0); + } + } +} + +char *getHomeDirector() +{ + return homeDirector; +} |