aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ioview.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2014-12-08 20:42:25 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2014-12-08 20:42:25 +0100
commit43777708af20f53abbe268cc908854071d971d36 (patch)
treebc8e80a08f029f0a809f955d6389b3beea536c15 /src/ioview.cpp
parent6e5a6113af29dcc2380e6884fb49ed0e4fcbe16d (diff)
downloadsciteco-43777708af20f53abbe268cc908854071d971d36.tar.gz
do not show possible completions for hidden files and directories
* added platform-dependant file_is_visible() function
Diffstat (limited to 'src/ioview.cpp')
-rw-r--r--src/ioview.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/ioview.cpp b/src/ioview.cpp
index b0a2d40..c052454 100644
--- a/src/ioview.cpp
+++ b/src/ioview.cpp
@@ -328,6 +328,16 @@ get_absolute_path(const gchar *path)
return resolved;
}
+bool
+file_is_visible(const gchar *path)
+{
+ gchar *basename = g_path_get_basename(path);
+ bool ret = *basename != '.';
+
+ g_free(basename);
+ return ret;
+}
+
#elif defined(G_OS_WIN32)
gchar *
@@ -342,6 +352,12 @@ get_absolute_path(const gchar *path)
return resolved;
}
+bool
+file_is_visible(const gchar *path)
+{
+ return !(get_file_attributes(path) & FILE_ATTRIBUTE_HIDDEN);
+}
+
#else
/*
@@ -353,6 +369,17 @@ get_absolute_path(const gchar *path)
return path ? g_file_read_link(path, NULL) : NULL;
}
+/*
+ * There's no platform-independant way to determine if a file
+ * is visible/hidden, so we just assume that all files are
+ * visible.
+ */
+bool
+file_is_visible(const gchar *path)
+{
+ return true;
+}
+
#endif /* !G_OS_UNIX && !G_OS_WIN32 */
} /* namespace SciTECO */