413 |
(gamegrid-add-score-with-update-game-score file score)))) |
(gamegrid-add-score-with-update-game-score file score)))) |
414 |
|
|
415 |
(defun gamegrid-add-score-with-update-game-score (file score) |
(defun gamegrid-add-score-with-update-game-score (file score) |
416 |
(let ((result nil) |
(let* ((result nil) |
417 |
(errbuf (generate-new-buffer " *update-game-score loss*")) |
(errbuf (generate-new-buffer " *update-game-score loss*")) |
418 |
(target (if game-score-directory |
(have-shared-game-dir |
419 |
file |
(not (zerop (logand (file-modes |
420 |
(let ((f (expand-file-name "~/.emacs.d/games"))) |
(expand-file-name "update-game-score" |
421 |
(unless (eq (car-safe (file-attributes f)) |
exec-directory)) |
422 |
t) |
#o4000)))) |
423 |
(make-directory f)) |
(target (if have-shared-game-dir |
424 |
(setq f (expand-file-name file f)) |
(expand-file-name file game-score-directory) |
425 |
(unless (file-exists-p f) |
(let ((f (expand-file-name game-score-directory))) |
426 |
(write-region "" nil f nil 'silent nil 'excl)) |
(when (file-writable-p f) |
427 |
f)))) |
(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)))) |
434 |
(let ((default-directory "/")) |
(let ((default-directory "/")) |
435 |
(apply |
(apply |
436 |
'call-process |
'call-process |
438 |
(list |
(list |
439 |
(expand-file-name "update-game-score" exec-directory) |
(expand-file-name "update-game-score" exec-directory) |
440 |
nil errbuf nil |
nil errbuf nil |
441 |
"-m" (int-to-string gamegrid-score-file-length) file |
"-m" (int-to-string gamegrid-score-file-length) |
442 |
|
"-d" (expand-file-name game-score-directory) file |
443 |
(int-to-string score) |
(int-to-string score) |
444 |
(concat |
(concat |
445 |
(user-full-name) |
(user-full-name) |