1 | /* |
1 | /* |
2 | * static char *rcsid_porting_c = |
2 | * static char *rcsid_porting_c = |
3 | * "$Id: porting.c,v 1.2 2006/05/11 18:37:52 root Exp $"; |
3 | * "$Id: porting.c,v 1.3 2006/07/20 03:57:03 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
615 | return; |
615 | return; |
616 | strcpy (buf, filename); |
616 | strcpy (buf, filename); |
617 | |
617 | |
618 | while ((cp = strchr (cp + 1, (int) '/'))) { |
618 | while ((cp = strchr (cp + 1, (int) '/'))) { |
619 | *cp = '\0'; |
619 | *cp = '\0'; |
620 | #if 0 |
|
|
621 | LOG(llevDebug, "\n Checking %s...", buf); |
|
|
622 | #endif |
|
|
623 | if (stat(buf, &statbuf) || !S_ISDIR (statbuf.st_mode)) { |
620 | if (stat(buf, &statbuf) || !S_ISDIR (statbuf.st_mode)) { |
624 | LOG(llevDebug, "Was not dir..."); |
|
|
625 | if (mkdir (buf, SAVE_DIR_MODE)) { |
621 | if (mkdir (buf, SAVE_DIR_MODE)) { |
626 | LOG(llevError, "Cannot mkdir %s: %s\n", buf, strerror_local(errno)); |
622 | LOG(llevError, "Cannot mkdir %s: %s\n", buf, strerror_local(errno)); |
627 | return; |
623 | return; |
628 | } |
624 | } |
629 | #if 0 |
|
|
630 | LOG(llevDebug, "Made dir."); |
|
|
631 | } else |
|
|
632 | LOG(llevDebug, "Was dir"); |
|
|
633 | #else |
|
|
634 | } |
625 | } |
635 | #endif |
|
|
636 | *cp = '/'; |
626 | *cp = '/'; |
637 | } |
627 | } |
638 | LOG(llevDebug,"\n"); |
|
|
639 | } |
628 | } |
640 | |
629 | |