mirror of
https://github.com/PixelGuys/Cubyz.git
synced 2025-09-08 19:50:23 -04:00
Use a different settings file in debug mode.
I keep getting annoyed by slow loading time in debug mode if my render distance is too high. This should speed up my debug cycles.
This commit is contained in:
parent
599d6bdb52
commit
daba532012
@ -1,4 +1,5 @@
|
||||
const std = @import("std");
|
||||
const builtin = @import("builtin");
|
||||
|
||||
const ZonElement = @import("zon.zig").ZonElement;
|
||||
const main = @import("main.zig");
|
||||
@ -63,8 +64,10 @@ pub var developerGPUInfiniteLoopDetection: bool = false;
|
||||
|
||||
pub var controllerAxisDeadzone: f32 = 0.0;
|
||||
|
||||
const settingsFile = if(builtin.mode == .Debug) "debug_settings.zig.zon" else "settings.zig.zon";
|
||||
|
||||
pub fn init() void {
|
||||
const zon: ZonElement = main.files.cubyzDir().readToZon(main.stackAllocator, "settings.zig.zon") catch |err| blk: {
|
||||
const zon: ZonElement = main.files.cubyzDir().readToZon(main.stackAllocator, settingsFile) catch |err| blk: {
|
||||
if(err != error.FileNotFound) {
|
||||
std.log.err("Could not read settings file: {s}", .{@errorName(err)});
|
||||
}
|
||||
@ -153,7 +156,7 @@ pub fn save() void {
|
||||
zonObject.put("keyboard", keyboard);
|
||||
|
||||
// Write to file:
|
||||
main.files.cubyzDir().writeZon("settings.zig.zon", zonObject) catch |err| {
|
||||
main.files.cubyzDir().writeZon(settingsFile, zonObject) catch |err| {
|
||||
std.log.err("Couldn't write settings to file: {s}", .{@errorName(err)});
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user