diff options
| -rw-r--r-- | lisp/play/gamegrid.el | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el index aff6a9bdec8..054358940d0 100644 --- a/lisp/play/gamegrid.el +++ b/lisp/play/gamegrid.el | |||
| @@ -413,18 +413,24 @@ static char *noname[] = { | |||
| 413 | (gamegrid-add-score-with-update-game-score file score)))) | 413 | (gamegrid-add-score-with-update-game-score file score)))) |
| 414 | 414 | ||
| 415 | (defun gamegrid-add-score-with-update-game-score (file score) | 415 | (defun gamegrid-add-score-with-update-game-score (file score) |
| 416 | (let ((result nil) | 416 | (let* ((result nil) |
| 417 | (errbuf (generate-new-buffer " *update-game-score loss*")) | 417 | (errbuf (generate-new-buffer " *update-game-score loss*")) |
| 418 | (target (if game-score-directory | 418 | (have-shared-game-dir |
| 419 | file | 419 | (not (zerop (logand (file-modes |
| 420 | (let ((f (expand-file-name "~/.emacs.d/games"))) | 420 | (expand-file-name "update-game-score" |
| 421 | (unless (eq (car-safe (file-attributes f)) | 421 | exec-directory)) |
| 422 | t) | 422 | #o4000)))) |
| 423 | (make-directory f)) | 423 | (target (if have-shared-game-dir |
| 424 | (setq f (expand-file-name file f)) | 424 | (expand-file-name file game-score-directory) |
| 425 | (unless (file-exists-p f) | 425 | (let ((f (expand-file-name game-score-directory))) |
| 426 | (write-region "" nil f nil 'silent nil 'excl)) | 426 | (when (file-writable-p f) |
| 427 | f)))) | 427 | (unless (eq (car-safe (file-attributes f)) |
| 428 | t) | ||
| 429 | (make-directory f)) | ||
| 430 | (setq f (expand-file-name file f)) | ||
| 431 | (unless (file-exists-p f) | ||
| 432 | (write-region "" nil f nil 'silent nil 'excl))) | ||
| 433 | f)))) | ||
| 428 | (let ((default-directory "/")) | 434 | (let ((default-directory "/")) |
| 429 | (apply | 435 | (apply |
| 430 | 'call-process | 436 | 'call-process |
| @@ -432,7 +438,8 @@ static char *noname[] = { | |||
| 432 | (list | 438 | (list |
| 433 | (expand-file-name "update-game-score" exec-directory) | 439 | (expand-file-name "update-game-score" exec-directory) |
| 434 | nil errbuf nil | 440 | nil errbuf nil |
| 435 | "-m" (int-to-string gamegrid-score-file-length) file | 441 | "-m" (int-to-string gamegrid-score-file-length) |
| 442 | "-d" (expand-file-name game-score-directory) file | ||
| 436 | (int-to-string score) | 443 | (int-to-string score) |
| 437 | (concat | 444 | (concat |
| 438 | (user-full-name) | 445 | (user-full-name) |