mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Normalize the path name before using it to open a config files. This
insures that you always get the same config file regardless of how you reference the data file. #90487 git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7617 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
16
ChangeLog
16
ChangeLog
@@ -18,6 +18,22 @@
|
|||||||
|
|
||||||
2002-12-03 David Hampton <hampton@employees.org>
|
2002-12-03 David Hampton <hampton@employees.org>
|
||||||
|
|
||||||
|
* src/scm/main.scm ((gnc:account-file-to-load)): Normalize the
|
||||||
|
path name before using it to open a config files. #90487
|
||||||
|
|
||||||
|
* src/scm/path.scm (gnc:load-user-config-if-needed): Write out a
|
||||||
|
new 1.8 version of the config file. Add the 1.8 version to the
|
||||||
|
list of files to try an read when reading the config. #100266
|
||||||
|
|
||||||
|
* src/engine/gnc-session.c (gnc_session_load): Don't erase the
|
||||||
|
just loaded account information because the backend is reporting
|
||||||
|
that the file is from a previous version. Let the caller decide
|
||||||
|
after querying the user. #97270.
|
||||||
|
|
||||||
|
* src/gnome/window-main.c (gnc_main_window_about_cb): Put the
|
||||||
|
build date into the about box for development versions of
|
||||||
|
gnucash. #99775
|
||||||
|
|
||||||
* src/register/ledger-core/split-register-control.c
|
* src/register/ledger-core/split-register-control.c
|
||||||
(gnc_split_register_move_cursor): Don't delete an empty split if
|
(gnc_split_register_move_cursor): Don't delete an empty split if
|
||||||
its the current transaction split. Dangling pointers are no
|
its the current transaction split. Dangling pointers are no
|
||||||
|
|||||||
@@ -512,12 +512,33 @@ string and 'directories' must be a list of strings."
|
|||||||
(gnc:debug "UI Shutdown hook.")
|
(gnc:debug "UI Shutdown hook.")
|
||||||
(gnc:file-quit))
|
(gnc:file-quit))
|
||||||
|
|
||||||
|
(define (gnc:normalize-path file)
|
||||||
|
(let* ((parts-in (string-split file #\/))
|
||||||
|
(parts-out '()))
|
||||||
|
|
||||||
|
;; Convert to a path based at the root
|
||||||
|
(if (not (string-null? (car parts-in)))
|
||||||
|
(set! parts-in (append (string-split (getenv "PWD") #\/) parts-in)))
|
||||||
|
|
||||||
|
;; Strip out "." and ".." components
|
||||||
|
(for-each
|
||||||
|
(lambda (part)
|
||||||
|
(cond ((string=? part ".") #f)
|
||||||
|
((string=? part "..") (set! parts-out (cdr parts-out)))
|
||||||
|
(else (set! parts-out (cons part parts-out)))))
|
||||||
|
parts-in)
|
||||||
|
|
||||||
|
;; Put it back together
|
||||||
|
(string-join (reverse parts-out) "/")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
(define (gnc:account-file-to-load)
|
(define (gnc:account-file-to-load)
|
||||||
(let ((ok (not (gnc:config-var-value-get gnc:*arg-no-file*)))
|
(let ((ok (not (gnc:config-var-value-get gnc:*arg-no-file*)))
|
||||||
(file (if (pair? gnc:*command-line-remaining*)
|
(file (if (pair? gnc:*command-line-remaining*)
|
||||||
(car gnc:*command-line-remaining*)
|
(car gnc:*command-line-remaining*)
|
||||||
(gnc:history-get-last))))
|
(gnc:history-get-last))))
|
||||||
(and ok (string? file) file)))
|
(and ok (string? file) (gnc:normalize-path file))))
|
||||||
|
|
||||||
(define (gnc:load-account-file)
|
(define (gnc:load-account-file)
|
||||||
(let ((file (gnc:account-file-to-load)))
|
(let ((file (gnc:account-file-to-load)))
|
||||||
|
|||||||
Reference in New Issue
Block a user