summaryrefslogtreecommitdiffstats
path: root/src/curses-ui/logo.vala
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2018-06-29 21:05:46 +0200
committerSebastian Reichel <sre@ring0.de>2018-07-15 22:59:57 +0200
commitcce1953eb1f8fe8c927a1720c95caed45b71ef1d (patch)
tree4ce0e1a234360ebb99f8bf6b6f2fa5d8ab842c55 /src/curses-ui/logo.vala
parent2d532b4a537327d66a15d20dc2e8aaad9b5f1dfc (diff)
downloadserial-barcode-scanner-cce1953eb1f8fe8c927a1720c95caed45b71ef1d.tar.bz2
all: simplify datadir configuration
This simplifies the datadir configuration and removes the expectation, that the code is executed from the repository. It should now be possible to install this into the system like any other common Linux application.
Diffstat (limited to 'src/curses-ui/logo.vala')
-rw-r--r--src/curses-ui/logo.vala14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/curses-ui/logo.vala b/src/curses-ui/logo.vala
index e7f6fb8..a4a2c2c 100644
--- a/src/curses-ui/logo.vala
+++ b/src/curses-ui/logo.vala
@@ -19,28 +19,28 @@ using Curses;
public class Logo {
Window win;
- public Logo(string binarylocation) {
+ public Logo(string datadir) {
win = new Window(8, COLS - 2, 0, 1);
win.bkgdset(COLOR_PAIR(1) | Attribute.BOLD);
win.addstr("\n");
- var file = File.new_for_path (binarylocation + "/../../logo.txt");
-
- if (!file.query_exists ()) {
+ var logofilename = Path.build_filename(datadir, "logo.txt");
+ var file = File.new_for_path(logofilename);
+ if (!file.query_exists()) {
stderr.printf (_("File '%s' doesn't exist.\n"), file.get_path ());
}
try {
// 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 dis = new DataInputStream(file.read());
string line;
// Read lines until end of file (null) is reached
- while ((line = dis.read_line (null)) != null) {
+ while ((line = dis.read_line(null)) != null) {
win.addstr(line+"\n");
}
- } catch (Error e) {
+ } catch(Error e) {
error (_("Error: %s"), e.message);
}