[rygel] core: Don't search for modules hidden folders
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Don't search for modules hidden folders
- Date: Fri, 19 Oct 2012 15:20:50 +0000 (UTC)
commit 230a684354004652b2551ee17b965f396bfbcc81
Author: Jens Georg <jensg openismus com>
Date: Fri Oct 19 17:00:57 2012 +0200
core: Don't search for modules hidden folders
Unless it's .libs so that --enable-uninstalled still works.
https://bugzilla.gnome.org/show_bug.cgi?id=686018
.../rygel-recursive-module-loader.vala | 23 ++++++++++++-------
1 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/src/librygel-core/rygel-recursive-module-loader.vala b/src/librygel-core/rygel-recursive-module-loader.vala
index f2c2756..f2ec0e2 100644
--- a/src/librygel-core/rygel-recursive-module-loader.vala
+++ b/src/librygel-core/rygel-recursive-module-loader.vala
@@ -32,6 +32,7 @@ public abstract class Rygel.RecursiveModuleLoader : Object {
private static const string LOADER_ATTRIBUTES =
FileAttribute.STANDARD_NAME + "," +
FileAttribute.STANDARD_TYPE + "," +
+ FileAttribute.STANDARD_IS_HIDDEN + "," +
FileAttribute.STANDARD_CONTENT_TYPE;
private delegate void FolderHandler (File folder);
@@ -166,11 +167,10 @@ public abstract class Rygel.RecursiveModuleLoader : Object {
FileInfo info,
FolderHandler handler) {
var file = folder.get_child (info.get_name ());
- FileType file_type = info.get_file_type ();
string content_type = info.get_content_type ();
string mime = ContentType.get_mime_type (content_type);
- if (file_type == FileType.DIRECTORY) {
+ if (this.is_folder_eligible (info)) {
handler (file);
} else if (mime == "application/x-sharedlib") {
// Seems like we found a module
@@ -181,6 +181,12 @@ public abstract class Rygel.RecursiveModuleLoader : Object {
}
+ private bool is_folder_eligible (FileInfo file_info) {
+ return file_info.get_file_type () == FileType.DIRECTORY &&
+ (file_info.get_name () == ".libs" ||
+ !file_info.get_is_hidden ());
+ }
+
/**
* Check if a File is a folder.
*
@@ -188,19 +194,18 @@ public abstract class Rygel.RecursiveModuleLoader : Object {
* @return true, if file is folder, false otherwise.
*/
private bool is_folder (File file) {
- FileInfo file_info;
-
try {
- file_info = file.query_info (FileAttribute.STANDARD_TYPE,
- FileQueryInfoFlags.NONE,
- null);
+ var file_info = file.query_info (FileAttribute.STANDARD_TYPE + "," +
+ FileAttribute.STANDARD_IS_HIDDEN,
+ FileQueryInfoFlags.NONE,
+ null);
+
+ return this.is_folder_eligible (file_info);
} catch (Error error) {
critical (_("Failed to query content type for '%s'"),
file.get_path ());
return false;
}
-
- return file_info.get_file_type () == FileType.DIRECTORY;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]