fix
use autocreate pref file. user pref for color/emoji linux
This commit is contained in:
@@ -476,6 +476,7 @@ static int CmdPrefSet (const char *Cmd)
|
||||
if (w != -99999) session.window_plot_wsize = w;
|
||||
// Need to work out how to change live....
|
||||
// calling data plot seems to work
|
||||
//plotwidget->MoveWindows ();
|
||||
|
||||
showPlotPosState ();
|
||||
break;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "preferences.h"
|
||||
|
||||
// Used to enable/disable use of preferences json file
|
||||
// #define USE_PREFERENCE_FILE
|
||||
#define USE_PREFERENCE_FILE
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -844,10 +844,20 @@ int main(int argc, char *argv[]) {
|
||||
// For info, grep --color=auto is doing sth like this, plus test getenv("TERM") != "dumb":
|
||||
// struct stat tmp_stat;
|
||||
// if ((fstat (STDOUT_FILENO, &tmp_stat) == 0) && (S_ISCHR (tmp_stat.st_mode)) && isatty(STDIN_FILENO))
|
||||
#ifdef USE_PREFERENCE_FILE
|
||||
if (!session.preferences_loaded) {
|
||||
if (session.stdinOnTTY && session.stdoutOnTTY) {
|
||||
session.supports_colors = true;
|
||||
session.emoji_mode = EMOJI;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (session.stdinOnTTY && session.stdoutOnTTY) {
|
||||
session.supports_colors = true;
|
||||
session.emoji_mode = EMOJI;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// Let's take a baudrate ok for real UART, USB-CDC & BT don't use that info anyway
|
||||
if (speed == 0)
|
||||
@@ -907,8 +917,10 @@ int main(int argc, char *argv[]) {
|
||||
// Save settings if not load from settings json file.
|
||||
// Doing this here will ensure other checks and updates are saved to over rule default
|
||||
// e.g. Linux color use check
|
||||
if (!session.preferences_loaded)
|
||||
preferences_save ();
|
||||
if (!session.preferences_loaded) {
|
||||
preferences_save (); // Save defaults
|
||||
session.preferences_loaded = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GUI
|
||||
|
||||
Reference in New Issue
Block a user