sharplispers / cormanlisp

Corman Lisp
MIT License
570 stars 78 forks source link

Preparing Corman Lisp for multiuser environments #18

Closed arbv closed 8 years ago

arbv commented 8 years ago

At this point in many cases (e. g. crash reports, "Lisp Worksheet" file creation, executables creation) Corman Lisp uses installation directory for output. I think this is not a good scenario for usage of the Corman Lisp in the multiuser environments (like computer classes in universities) where a user may have not enough permissions for a writing to the installation directory. It is better to modify Corman Lisp accordingly (e. g. it should use something like "%USERPFROFILE%\Documents\Corman Lisp\" for output).

Also, I think Corman Lisp should look for the init file (let's name it "corman-init.lisp") in the user profile directory additionally to the system-wide init file in the installation directory ("init.lisp"). For the better compatibility with older versions it should load system-wide init file before one in the user profile directory. It should be noted that applications created with Corman Lisp should ignore these files.

I suppose this is a valuable addition and it looks like it is certainly doable.

arbv commented 8 years ago

Notes:

The SHGetFolderPath() function with CSIDL_PERSONAL parameter should return path to the Documents folder. https://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx https://msdn.microsoft.com/en-us/library/bb762494(v=vs.85).aspx

GetUserProfileDirectory() can be used for obtaining user profile directory. https://msdn.microsoft.com/en-us/library/windows/desktop/bb762280(v=vs.85).aspx

GetUserName() can be used to obtain current user login name. https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms724432(v=vs.85).aspx

arbv commented 8 years ago

Done. At the moment Corman Lisp should work fine in multiuser environments. It is generally avoids writing into installation directory at the moment. There might be some caveats but I believe it should work fine.

Important changes:

I updated manual according to the above mentioned changes.

Additionally to the above mentioned changes, COMPILE-FILE and LOAD were modified to support ".lsp" and ".cl" extensions, not only ".lisp". For better compatibility with previous releases LOAD looks for the file in the installation directory (as the last resort), so e.g. "(load "examples\gui\life-gui.lisp") will still work as expected.