[rygel] core: Minor optimization/re-factor
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] core: Minor optimization/re-factor
- Date: Fri, 19 Nov 2010 13:22:29 +0000 (UTC)
commit f082f6a35d260d34436bd921fb1a811c32f505c8
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Nov 17 19:18:16 2010 +0200
core: Minor optimization/re-factor
src/rygel/rygel-root-device-factory.vala | 15 ++++-----------
1 files changed, 4 insertions(+), 11 deletions(-)
---
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index d611703..a2300cd 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -312,11 +312,11 @@ internal class Rygel.RootDeviceFactory {
private XMLDoc get_latest_doc (string path1,
string path2) throws GLib.Error {
- if (!check_path_exist (path1)) {
+ var file = File.new_for_path (path1);
+ if (!file.query_exists (null)) {
return new XMLDoc.from_path (path2);
}
- var file = File.new_for_path (path1);
var info = file.query_info (FILE_ATTRIBUTE_TIME_MODIFIED,
FileQueryInfoFlags.NONE);
var mod1 = info.get_attribute_uint64 (FILE_ATTRIBUTE_TIME_MODIFIED);
@@ -333,16 +333,9 @@ internal class Rygel.RootDeviceFactory {
}
}
- private bool check_path_exist (string path) {
- var file = File.new_for_path (path);
-
- return file.query_exists (null);
- }
-
private void ensure_dir_exists (string dir_path) throws Error {
- if (!check_path_exist (dir_path)) {
- var file = File.new_for_path (dir_path);
-
+ var file = File.new_for_path (dir_path);
+ if (!file.query_exists (null)) {
file.make_directory (null);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]