comparison src/ui_fileops.c @ 701:28af4b6dd9ef

Use G_DIR_SEPARATOR instead of '/' where applicable.
author zas_
date Tue, 20 May 2008 22:00:14 +0000
parents fbebf5cf4a55
children e07895754e65
comparison
equal deleted inserted replaced
700:b2eb4ff74d13 701:28af4b6dd9ef
594 { 594 {
595 const gchar *base; 595 const gchar *base;
596 596
597 if (!path) return NULL; 597 if (!path) return NULL;
598 598
599 base = strrchr(path, '/'); 599 base = strrchr(path, G_DIR_SEPARATOR);
600 if (base) return base + 1; 600 if (base) return base + 1;
601 601
602 return path; 602 return path;
603 } 603 }
604 604
608 608
609 if (!path) return NULL; 609 if (!path) return NULL;
610 610
611 while (path[p]) 611 while (path[p])
612 { 612 {
613 if (path[p] == '/') n = p; 613 if (path[p] == G_DIR_SEPARATOR) n = p;
614 p++; 614 p++;
615 } 615 }
616 if (n <= 0) n++; 616 if (n <= 0) n++;
617 617
618 return g_strndup(path, (gsize) n); 618 return g_strndup(path, (gsize) n);
672 672
673 s = t = 0; 673 s = t = 0;
674 674
675 while (path[s] != '\0') 675 while (path[s] != '\0')
676 { 676 {
677 if (path[s] == '/' && path[s+1] == '.' && (path[s+2] == '/' || path[s+2] == '\0') ) 677 if (path[s] == G_DIR_SEPARATOR && path[s+1] == '.' && (path[s+2] == G_DIR_SEPARATOR || path[s+2] == '\0') )
678 { 678 {
679 s += 2; 679 s += 2;
680 } 680 }
681 else if (path[s] == '/' && path[s+1] == '.' && path[s+2] == '.' && (path[s+3] == '/' || path[s+3] == '\0') ) 681 else if (path[s] == G_DIR_SEPARATOR && path[s+1] == '.' && path[s+2] == '.' && (path[s+3] == G_DIR_SEPARATOR || path[s+3] == '\0') )
682 { 682 {
683 s += 3; 683 s += 3;
684 if (t > 0) t--; 684 if (t > 0) t--;
685 while (path[t] != '/' && t > 0) t--; 685 while (path[t] != G_DIR_SEPARATOR && t > 0) t--;
686 } 686 }
687 else 687 else
688 { 688 {
689 if (s != t) path[t] = path[s]; 689 if (s != t) path[t] = path[s];
690 t++; 690 t++;
691 s++; 691 s++;
692 } 692 }
693 } 693 }
694 if (t == 0 && path[t] == '/') t++; 694 if (t == 0 && path[t] == G_DIR_SEPARATOR) t++;
695 if (t > 1 && path[t-1] == '/') t--; 695 if (t > 1 && path[t-1] == G_DIR_SEPARATOR) t--;
696 path[t] = '\0'; 696 path[t] = '\0';
697 } 697 }
698 698
699 gint file_in_path(const gchar *name) 699 gint file_in_path(const gchar *name)
700 { 700 {