diff options
author | Colin Walters <walters@gnu.org> | 2002-04-10 23:16:45 +0000 |
---|---|---|
committer | Colin Walters <walters@gnu.org> | 2002-04-10 23:16:45 +0000 |
commit | dcec69ee9923ea6cc6ac8ab9b5e9a0b9224c2571 (patch) | |
tree | 6f666b78f47d7f2fc5612e837aa09348ffb80f6f /lisp/play/gamegrid.el | |
parent | 98418dbaa78b22098421efb6968a575948f19dad (diff) | |
download | emacs-dcec69ee9923ea6cc6ac8ab9b5e9a0b9224c2571.tar.gz |
Fix previous change.
Diffstat (limited to 'lisp/play/gamegrid.el')
-rw-r--r-- | lisp/play/gamegrid.el | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el index ffb179d52d2..342b7a5cd14 100644 --- a/lisp/play/gamegrid.el +++ b/lisp/play/gamegrid.el @@ -407,7 +407,17 @@ static char *noname[] = { (defun gamegrid-add-score (file score) "Add the current score to the high score file." (let ((result nil) - (errbuf (generate-new-buffer " *update-game-score loss*"))) + (errbuf (generate-new-buffer " *update-game-score loss*")) + (target (if game-score-directory + file + (let ((f (expand-file-name "~/.emacs.d/games"))) + (unless (eq (car-safe (file-attributes f)) + t) + (make-directory f)) + (setq f (expand-file-name file f)) + (unless (file-exists-p f) + (write-region "" nil f nil 'silent nil 'excl)) + f)))) (let ((default-directory "/")) (apply 'call-process @@ -426,14 +436,14 @@ static char *noname[] = { user-mail-address) (t "")) "> " - (current-time-string))))) - (if (buffer-modified-p errbuf) - (progn - (display-buffer errbuf) - (error "Failed to update game score file")) - (kill-buffer errbuf)))) - (save-excursion - (find-file-read-only-other-window (expand-file-name file game-score-directory)))) + (current-time-string)))))) + (if (buffer-modified-p errbuf) + (progn + (display-buffer errbuf) + (error "Failed to update game score file")) + (kill-buffer errbuf)) + (save-excursion + (find-file-read-only-other-window target)))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |