[libgames-support] Simplify scores directory creation code
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgames-support] Simplify scores directory creation code
- Date: Sun, 20 Sep 2015 22:55:25 +0000 (UTC)
commit f8b86c6b2c71986d4bafab78db0f961f64401e70
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Sep 20 17:27:43 2015 -0500
Simplify scores directory creation code
No point in checking if it already exists. Also, let's report a real
error if this somehow fails.
games/scores/context.vala | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/games/scores/context.vala b/games/scores/context.vala
index 5885075..425d9e1 100644
--- a/games/scores/context.vala
+++ b/games/scores/context.vala
@@ -181,12 +181,9 @@ public class Context : Object
private async void save_score_to_file (Score score, Category category) throws Error
{
- if (!FileUtils.test (user_score_dir, FileTest.EXISTS))
+ if (DirUtils.create_with_parents (user_score_dir, 0766) == -1)
{
- if (DirUtils.create_with_parents (user_score_dir, 0766) == -1)
- {
- throw new FileError.FAILED ("Error: Could not create directory.");
- }
+ throw new FileError.FAILED ("Failed to create %s: %s", user_score_dir, strerror (errno));
}
var file = File.new_for_path (Path.build_filename (user_score_dir, category.key));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]