static void check_cache_dir(void)
{
if (!cache_dir) {
- fatal("Unable to determine home directory");
+ fatal("Unable to determine cache directory");
}
}
char *p;
current_working_dir = get_cwd();
-
cache_dir = getenv("CCACHE_DIR");
if (!cache_dir) {
const char *home_directory = get_home_directory();
}
}
+ /* check if we are being invoked as "ccache" */
+ if (strlen(argv[0]) >= strlen(MYNAME) &&
+ strcmp(argv[0] + strlen(argv[0]) - strlen(MYNAME), MYNAME) == 0) {
+ if (argc < 2) {
+ usage();
+ exit(1);
+ }
+ /* if the first argument isn't an option, then assume we are
+ being passed a compiler name and options */
+ if (argv[1][0] == '-') {
+ return ccache_main(argc, argv);
+ }
+ }
+
+ check_cache_dir();
+
temp_dir = getenv("CCACHE_TEMPDIR");
if (!temp_dir) {
x_asprintf(&temp_dir, "%s/tmp", cache_dir);
}
}
-
- /* check if we are being invoked as "ccache" */
- if (strlen(argv[0]) >= strlen(MYNAME) &&
- strcmp(argv[0] + strlen(argv[0]) - strlen(MYNAME), MYNAME) == 0) {
- if (argc < 2) {
- usage();
- exit(1);
- }
- /* if the first argument isn't an option, then assume we are
- being passed a compiler name and options */
- if (argv[1][0] == '-') {
- return ccache_main(argc, argv);
- }
- }
-
/* make sure the cache dir exists */
if (create_dir(cache_dir) != 0) {
fprintf(stderr,"ccache: failed to create %s (%s)\n",