Mercurial > hg > nnchat
comparison main.c @ 664:87ef546de419
Create configuration directory path if it does not yet exist when saving
configuration.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 12 Feb 2016 03:03:51 +0200 |
parents | 0b81e5fdc7b5 |
children | 1b18551b25e7 |
comparison
equal
deleted
inserted
replaced
663:0b81e5fdc7b5 | 664:87ef546de419 |
---|---|
94 optDebug = FALSE, | 94 optDebug = FALSE, |
95 optLogEnable = FALSE, | 95 optLogEnable = FALSE, |
96 optLogDaily = FALSE, | 96 optLogDaily = FALSE, |
97 optOnlyFriendPrv = FALSE; | 97 optOnlyFriendPrv = FALSE; |
98 | 98 |
99 char *setHomeDir = NULL, *setConfigDir = NULL, *setProxyURI = NULL; | |
99 th_llist_t *setIgnoreList = NULL, | 100 th_llist_t *setIgnoreList = NULL, |
100 *setFriendList = NULL, | 101 *setFriendList = NULL, |
101 *setIdleMessages = NULL; | 102 *setIdleMessages = NULL; |
102 nn_userhash_t *nnUsers = NULL; | 103 nn_userhash_t *nnUsers = NULL; |
103 char *setConfigFile = NULL, | 104 char *setConfigFile = NULL, |
1268 (void) buf; | 1269 (void) buf; |
1269 th_ioctx *ctx = NULL; | 1270 th_ioctx *ctx = NULL; |
1270 #ifndef TH_PLAT_WINDOWS | 1271 #ifndef TH_PLAT_WINDOWS |
1271 int cfgfd = -1; | 1272 int cfgfd = -1; |
1272 #endif | 1273 #endif |
1274 | |
1275 if (!th_mkdir_path(setConfigDir, 0)) | |
1276 { | |
1277 printMsgQ(currWin, "Could not create configuration file directory '%s'.\n", | |
1278 setConfigDir); | |
1279 goto error; | |
1280 } | |
1273 | 1281 |
1274 if ((ctx = th_io_new(&th_stdio_io_ops, setConfigFile)) == NULL) | 1282 if ((ctx = th_io_new(&th_stdio_io_ops, setConfigFile)) == NULL) |
1275 { | 1283 { |
1276 printMsgQ(currWin, "Could not initialize I/O context for configuration file writing!\n"); | 1284 printMsgQ(currWin, "Could not initialize I/O context for configuration file writing!\n"); |
1277 goto error; | 1285 goto error; |
1945 BOOL argsOK, colorSet = FALSE; | 1953 BOOL argsOK, colorSet = FALSE; |
1946 th_conn_t *conn = NULL; | 1954 th_conn_t *conn = NULL; |
1947 nn_editbuf_t *editBuf = nn_editbuf_new(NN_TMPBUF_SIZE); | 1955 nn_editbuf_t *editBuf = nn_editbuf_new(NN_TMPBUF_SIZE); |
1948 nn_editstate_t editState; | 1956 nn_editstate_t editState; |
1949 th_cfgitem_t *tmpcfg; | 1957 th_cfgitem_t *tmpcfg; |
1950 char *setHomeDir = NULL, *setConfigDir = NULL, *setProxyURI = NULL; | |
1951 | 1958 |
1952 memset(editHistBuf, 0, sizeof(editHistBuf)); | 1959 memset(editHistBuf, 0, sizeof(editHistBuf)); |
1953 clearEditState(&editState); | 1960 clearEditState(&editState); |
1954 | 1961 |
1955 // Initialize | 1962 // Initialize |