mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-16 18:25:11 -06:00
Replace access by _waccess on Windows. Fix leak from r15429.
As g_access is new in GLib 2.8, use _waccess directly. Also free the results of g_utf8_to_utf16. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15430 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
89e7929fc0
commit
275069ff90
@ -299,6 +299,7 @@ file_session_end(QofBackend *be_start)
|
||||
PWARN("Error on chmod(%s): %d: %s", be->lockfile,
|
||||
errno, strerror(errno) ? strerror(errno) : "");
|
||||
}
|
||||
g_free (wlock);
|
||||
#endif
|
||||
rv = g_unlink (be->lockfile);
|
||||
if (rv) {
|
||||
|
@ -449,6 +449,7 @@ gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page,
|
||||
|
||||
const char * path_to_load;
|
||||
const gchar * default_acctname = NULL;
|
||||
int rv;
|
||||
|
||||
SCM make_qif_file = scm_c_eval_string("make-qif-file");
|
||||
SCM qif_file_load = scm_c_eval_string("qif-file:read-file");
|
||||
@ -476,7 +477,17 @@ gnc_ui_qif_import_load_file_next_cb(GnomeDruidPage * page,
|
||||
gnc_error_dialog(wind->window, _("Please select a file to load."));
|
||||
return TRUE;
|
||||
}
|
||||
else if ((strlen(path_to_load) > 0) && access(path_to_load, R_OK) < 0) {
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
{
|
||||
wchar_t *wpath = g_utf8_to_utf16(path_to_load, -1, NULL, NULL, NULL);
|
||||
rv = wpath ? _waccess(wpath, R_OK) : -1;
|
||||
g_free(wpath);
|
||||
}
|
||||
#else
|
||||
rv = access(path_to_load, R_OK);
|
||||
#endif
|
||||
if (rv < 0) {
|
||||
/* stay here if bad file */
|
||||
gnc_error_dialog(wind->window,
|
||||
_("File not found or read permission denied. "
|
||||
|
Loading…
Reference in New Issue
Block a user