[libgames-support] Simplify load_scores_from_files a bit
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgames-support] Simplify load_scores_from_files a bit
- Date: Sun, 20 Sep 2015 22:55:15 +0000 (UTC)
commit a776cdffefbbd58bc67d2cd526ac1d8797393377
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Sun Sep 20 17:19:00 2015 -0500
Simplify load_scores_from_files a bit
games/scores/context.vala | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/games/scores/context.vala b/games/scores/context.vala
index a09a99b..3558b7a 100644
--- a/games/scores/context.vala
+++ b/games/scores/context.vala
@@ -230,15 +230,10 @@ public class Context : Object
var category = category_request (category_key);
var filename = Path.build_filename (user_score_dir, category_key);
var scores_of_single_category = new Gee.PriorityQueue<Score> ((owned) scorecmp);
- var file = File.new_for_path (filename);
-
- /* Open file for reading and wrap returned FileInputStream into a
- DataInputStream, so we can read line by line */
- var dis = new DataInputStream (file.read ());
+ var stream = FileStream.open (filename, "r");
string line;
- /* Read lines until end of file (null) is reached */
- while ((line = dis.read_line (null)) != null)
+ while ((line = stream.read_line ()) != null)
{
var tokens = line.split (" ", 3);
string? user = null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]