Adding windows support for paths.
This commit is contained in:
parent
7cced990e7
commit
0491f28146
12
meson.build
12
meson.build
@ -1,4 +1,10 @@
|
|||||||
project('me.sergiotarxz.recuento', 'vala')
|
project('me.sergiotarxz.recuento', 'vala')
|
||||||
|
compiler = meson.get_compiler('c')
|
||||||
|
ws = '/'
|
||||||
|
|
||||||
|
if compiler.has_header('windows.h')
|
||||||
|
ws = '\\'
|
||||||
|
endif
|
||||||
|
|
||||||
vapidir = meson.project_source_root() / 'vapi'
|
vapidir = meson.project_source_root() / 'vapi'
|
||||||
recuentodeps = [
|
recuentodeps = [
|
||||||
@ -14,12 +20,14 @@ sources = [
|
|||||||
'src/main.vala',
|
'src/main.vala',
|
||||||
]
|
]
|
||||||
|
|
||||||
datadir = get_option('prefix') + '/' + get_option('datadir')
|
datadir_unix = get_option('prefix') + '/' + get_option('datadir')
|
||||||
|
datadir = get_option('prefix') + ws + get_option('datadir')
|
||||||
|
|
||||||
config_h = configure_file (
|
config_h = configure_file (
|
||||||
output : 'config.h',
|
output : 'config.h',
|
||||||
configuration : {
|
configuration : {
|
||||||
'DATADIR' : f'"@datadir@"',
|
'DATADIR' : f'"@datadir@"',
|
||||||
|
'WS': f'"@ws@"',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +36,7 @@ preloaded_images_files = [ 'psoe.jpg', 'pp.jpg', 'vox.jpg' ]
|
|||||||
foreach i : preloaded_images_files
|
foreach i : preloaded_images_files
|
||||||
install_data(
|
install_data(
|
||||||
'resources/preloaded_images' / i,
|
'resources/preloaded_images' / i,
|
||||||
install_dir: datadir / 'recuento/preloaded_images/',
|
install_dir: datadir_unix / 'recuento/preloaded_images/',
|
||||||
)
|
)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
const string SQLITE_PATH = ".config/recuento.sqlite";
|
const string S = Config.WS;
|
||||||
const string PRELOADED_IMAGES_PATH = Config.DATADIR + "/recuento/preloaded_images";
|
const string SQLITE_PATH = ".config" + S + "recuento.sqlite";
|
||||||
const string PSOE_IMAGE = PRELOADED_IMAGES_PATH + "/psoe.jpg";
|
const string PRELOADED_IMAGES_PATH = Config.DATADIR + S + "recuento" + S + "preloaded_images";
|
||||||
const string PP_IMAGE = PRELOADED_IMAGES_PATH + "/pp.jpg";
|
const string PSOE_IMAGE = PRELOADED_IMAGES_PATH + S + "psoe.jpg";
|
||||||
const string VOX_IMAGE = PRELOADED_IMAGES_PATH + "/vox.jpg";
|
const string PP_IMAGE = PRELOADED_IMAGES_PATH + S + "pp.jpg";
|
||||||
|
const string VOX_IMAGE = PRELOADED_IMAGES_PATH + S + "vox.jpg";
|
||||||
const string[] MIGRATIONS = {
|
const string[] MIGRATIONS = {
|
||||||
"CREATE TABLE options (key TEXT PRIMARY KEY, value TEXT);",
|
"CREATE TABLE options (key TEXT PRIMARY KEY, value TEXT);",
|
||||||
"CREATE TABLE parties (" +
|
"CREATE TABLE parties (" +
|
||||||
@ -267,7 +268,7 @@ void create_select_party_image_button (Gtk.Picture picture, Gtk.Box input_fields
|
|||||||
Sqlite.Database get_db () {
|
Sqlite.Database get_db () {
|
||||||
Sqlite.Database db;
|
Sqlite.Database db;
|
||||||
string home = GLib.Environment.get_home_dir ();
|
string home = GLib.Environment.get_home_dir ();
|
||||||
string final_sqlite_path = @"$home/$SQLITE_PATH";
|
string final_sqlite_path = @"$home$S$SQLITE_PATH";
|
||||||
print(final_sqlite_path);
|
print(final_sqlite_path);
|
||||||
int rc = Sqlite.Database.open (final_sqlite_path, out db);
|
int rc = Sqlite.Database.open (final_sqlite_path, out db);
|
||||||
apply_migrations (db);
|
apply_migrations (db);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
[CCode (cheader_filename = "config.h", lower_case_cprefix = "")]
|
[CCode (cheader_filename = "config.h", lower_case_cprefix = "")]
|
||||||
namespace Config {
|
namespace Config {
|
||||||
public const string DATADIR;
|
public const string DATADIR;
|
||||||
|
public const string WS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user