changeset 726:a1dcef8cd1ae

Use G_DIR_SEPARATOR where applicable.
author zas_
date Wed, 21 May 2008 11:07:23 +0000
parents eda074e91ddd
children d897ff542ad9
files src/cache.c src/collect-io.c src/collect.c src/layout.c src/main.c src/pan-item.c src/pan-util.c src/pan-view.c src/ui_pathsel.c src/ui_tabcomp.c src/ui_utildlg.c src/utilops.c src/view_dir_tree.c src/view_file_list.c
diffstat 14 files changed, 25 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/src/cache.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/cache.c	Wed May 21 11:07:23 2008 +0000
@@ -593,7 +593,7 @@
 		while (p[0] != '\0')
 			{
 			p++;
-			if (p[0] == '/' || p[0] == '\0')
+			if (p[0] == G_DIR_SEPARATOR || p[0] == '\0')
 				{
 				gint end = TRUE;
 				if (p[0] != '\0')
@@ -610,7 +610,7 @@
 						return FALSE;
 						}
 					}
-				if (!end) p[0] = '/';
+				if (!end) p[0] = G_DIR_SEPARATOR;
 				}
 			}
 		}
--- a/src/collect-io.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/collect-io.c	Wed May 21 11:07:23 2008 +0000
@@ -155,7 +155,7 @@
 			if (!flush)
 				changed |= collect_manager_process_action(entry, &buf);
 
-			valid = (buf[0] == '/' && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE));
+			valid = (buf[0] == G_DIR_SEPARATOR && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE));
 			if (!valid) DEBUG_1("collection invalid file: %s", buf);
 			g_free(buf);
 
--- a/src/collect.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/collect.c	Wed May 21 11:07:23 2008 +0000
@@ -1253,7 +1253,7 @@
 
 	collection_set_update_info_func(cw->cd, collection_window_update_info, cw);
 
-	if (path && *path == '/') collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE);
+	if (path && *path == G_DIR_SEPARATOR) collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE);
 
 	return cw;
 }
--- a/src/layout.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/layout.c	Wed May 21 11:07:23 2008 +0000
@@ -149,7 +149,7 @@
 		if ((!lw->path || strcmp(lw->path, buf) != 0) && layout_set_path(lw, buf))
 			{
 			gint pos = -1;
-			/* put the '/' back, if we are in tab completion for a dir and result was path change */
+			/* put the G_DIR_SEPARATOR back, if we are in tab completion for a dir and result was path change */
 			gtk_editable_insert_text(GTK_EDITABLE(lw->path_entry), G_DIR_SEPARATOR_S, -1, &pos);
 			gtk_editable_set_position(GTK_EDITABLE(lw->path_entry),
 						  strlen(gtk_entry_get_text(GTK_ENTRY(lw->path_entry))));
--- a/src/main.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/main.c	Wed May 21 11:07:23 2008 +0000
@@ -297,7 +297,7 @@
 			const gchar *cmd_line = argv[i];
 			gchar *cmd_all = g_build_filename(base_dir, cmd_line, NULL);
 
-			if (cmd_line[0] == '/' && isdir(cmd_line))
+			if (cmd_line[0] == G_DIR_SEPARATOR && isdir(cmd_line))
 				{
 				parse_command_line_process_dir(cmd_line, path, file, &list, &first_dir);
 				}
@@ -305,7 +305,7 @@
 				{
 				parse_command_line_process_dir(cmd_all, path, file, &list, &first_dir);
 				}
-			else if (cmd_line[0] == '/' && isfile(cmd_line))
+			else if (cmd_line[0] == G_DIR_SEPARATOR && isfile(cmd_line))
 				{
 				parse_command_line_process_file(cmd_line, path, file,
 								&list, collection_list, &first_dir);
--- a/src/pan-item.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/pan-item.c	Wed May 21 11:07:23 2008 +0000
@@ -739,7 +739,7 @@
 			{
 			gint match = FALSE;
 
-			if (path[0] == '/')
+			if (path[0] == G_DIR_SEPARATOR)
 				{
 				if (pi->fd->path && strcmp(path, pi->fd->path) == 0) match = TRUE;
 				}
@@ -785,7 +785,7 @@
 	GList *list = NULL;
 
 	if (!path) return NULL;
-	if (partial && path[0] == '/') return NULL;
+	if (partial && path[0] == G_DIR_SEPARATOR) return NULL;
 
 	list = pan_item_find_by_path_l(list, pw->list_static, type, path, ignore_case, partial);
 	list = pan_item_find_by_path_l(list, pw->list, type, path, ignore_case, partial);
--- a/src/pan-util.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/pan-util.c	Wed May 21 11:07:23 2008 +0000
@@ -158,10 +158,10 @@
 
 			parse_out_relatives(sl);
 
-			if (buf[0] == '/')
+			if (buf[0] == G_DIR_SEPARATOR)
 				{
 				if (strncmp(sl, buf, l) == 0 &&
-				    (sl[l] == '\0' || sl[l] == '/' || l == 1)) ret = TRUE;
+				    (sl[l] == '\0' || sl[l] == G_DIR_SEPARATOR || l == 1)) ret = TRUE;
 				}
 			else
 				{
@@ -171,7 +171,7 @@
 				parse_out_relatives(link_path);
 
 				if (strncmp(sl, link_path, l) == 0 &&
-				    (sl[l] == '\0' || sl[l] == '/' || l == 1)) ret = TRUE;
+				    (sl[l] == '\0' || sl[l] == G_DIR_SEPARATOR || l == 1)) ret = TRUE;
 
 				g_free(link_path);
 				}
--- a/src/pan-view.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/pan-view.c	Wed May 21 11:07:23 2008 +0000
@@ -1646,7 +1646,7 @@
 	image_scroll_to_point(pw->imd, pi->x + pi->width / 2, pi->y + pi->height / 2, 0.5, 0.5);
 
 	buf = g_strdup_printf("%s ( %d / %d )",
-			      (path[0] == '/') ? _("path found") : _("filename found"),
+			      (path[0] == G_DIR_SEPARATOR) ? _("path found") : _("filename found"),
 			      g_list_index(list, pi) + 1,
 			      g_list_length(list));
 	pan_search_status(pw, buf);
--- a/src/ui_pathsel.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/ui_pathsel.c	Wed May 21 11:07:23 2008 +0000
@@ -184,7 +184,7 @@
 		    && dir->d_name[0] == '.' && dir->d_name[1] == '\0')
 			continue;
 		if (dir->d_name[0] == '.' && dir->d_name[1] == '.' && dir->d_name[2] == '\0'
-		    && pathl[0] == '/' && pathl[1] == '\0')
+		    && pathl[0] == G_DIR_SEPARATOR && pathl[1] == '\0')
 			continue; /* no .. for root directory */
 		if (dd->show_hidden || !is_hidden(dir->d_name))
 			{
@@ -1207,7 +1207,7 @@
 		dd->filter = g_strdup(gtk_entry_get_text(GTK_ENTRY(GTK_BIN(dd->filter_combo)->child)));
 		}
 
-	if (path && path[0] == '/' && isdir(path))
+	if (path && path[0] == G_DIR_SEPARATOR && isdir(path))
 		{
 		dest_populate(dd, path);
 		}
--- a/src/ui_tabcomp.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/ui_tabcomp.c	Wed May 21 11:07:23 2008 +0000
@@ -51,7 +51,7 @@
 /* ----------------------------------------------------------------
    Tab completion routines, can be connected to any gtkentry widget
    using the tab_completion_add_to_entry() function.
-   Use remove_trailing_slash() to strip the trailing '/'.
+   Use remove_trailing_slash() to strip the trailing G_DIR_SEPARATOR.
    ----------------------------------------------------------------*/
 
 typedef struct _TabCompData TabCompData;
@@ -821,7 +821,7 @@
 	if (!path) return NULL;
 
 	l = strlen(path);
-	while (l > 1 && path[l - 1] == '/') l--;
+	while (l > 1 && path[l - 1] == G_DIR_SEPARATOR) l--;
 
 	return g_strndup(path, l);
 }
--- a/src/ui_utildlg.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/ui_utildlg.c	Wed May 21 11:07:23 2008 +0000
@@ -386,7 +386,7 @@
 	generic_dialog_attach_default(GENERIC_DIALOG(fdlg), fdlg->entry);
 	gtk_widget_show(tabcomp);
 
-	if (path && path[0] == '/')
+	if (path && path[0] == G_DIR_SEPARATOR)
 		{
 		fdlg->dest_path = g_strdup(path);
 		}
--- a/src/utilops.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/utilops.c	Wed May 21 11:07:23 2008 +0000
@@ -1109,7 +1109,7 @@
 		return;
 		}
 
-	if (!fdlg->dest_path || fdlg->dest_path[0] != '/')
+	if (!fdlg->dest_path || fdlg->dest_path[0] != G_DIR_SEPARATOR)
 		{
 		if (fdlg->source_fd)
 			{
@@ -2772,7 +2772,7 @@
 
 	if (strlen(name) == 0) return;
 
-	if (name[0] == '/')
+	if (name[0] == G_DIR_SEPARATOR)
 		{
 		gchar *buf;
 		buf  = remove_level_from_path(name);
--- a/src/view_dir_tree.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/view_dir_tree.c	Wed May 21 11:07:23 2008 +0000
@@ -206,7 +206,7 @@
 
 	strp = path;
 
-	if (*strp != '/') return NULL;
+	if (*strp != G_DIR_SEPARATOR) return NULL;
 
 	strp++;
 	strb = strp;
@@ -214,7 +214,7 @@
 
 	while (*strp != '\0')
 		{
-		if (*strp == '/')
+		if (*strp == G_DIR_SEPARATOR)
 			{
 			if (l > 0) list = g_list_prepend(list, g_strndup(strb, l));
 			strp++;
@@ -465,14 +465,14 @@
 		gint n;
 
 		n = strlen(nd->fd->path);
-		if (target_path[n] == '/' && target_path[n+1] == '.')
+		if (target_path[n] == G_DIR_SEPARATOR && target_path[n+1] == '.')
 			{
 			gchar *name8;
 			struct stat sbuf;
 
 			n++;
 
-			while (target_path[n] != '\0' && target_path[n] != '/') n++;
+			while (target_path[n] != '\0' && target_path[n] != G_DIR_SEPARATOR) n++;
 			name8 = g_strndup(target_path, n);
 
 			if (stat_utf8(name8, &sbuf))
--- a/src/view_file_list.c	Wed May 21 11:00:13 2008 +0000
+++ b/src/view_file_list.c	Wed May 21 11:07:23 2008 +0000
@@ -384,7 +384,7 @@
 	old_path = g_build_filename(vf->path, old, NULL);
 	new_path = g_build_filename(vf->path, new, NULL);
 
-	if (strchr(new, '/') != NULL)
+	if (strchr(new, G_DIR_SEPARATOR) != NULL)
 		{
 		gchar *text = g_strdup_printf(_("Invalid file name:\n%s"), new);
 		file_util_warning_dialog(_("Error renaming file"), text, GTK_STOCK_DIALOG_ERROR, vf->listview);