>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> I believe I have got everything running as it should for a unix
Angus> box. It should be able to follow symbolic links. It should be
Angus> able to work out whether it is running in-place or has been
Angus> installed. (To install, simply place in /usr/local/bin or
Angus> wherever you install LyX. You'll need to adjust PACKAGE in
Angus> config.h to be able to find the LyX system directory.)

Nice work :)

Angus> All the fun is in package.C. It should now be (fairly)
Angus> understandable... ;-)

Angus> MacOS users: what needs to be changed to get things working for
Angus> you too?

A few remarks, in no particular order:

- in case you did not notice already: win32_folder_path contains lots
  of unicode junk

- it is a bit strange to have functions names set_foo() that do not
  set anything but actually return a value. Maybe get_foo() would be
  better? 

- in set_build_lyxdir, are you sure there is a real need for following
  symlinks? Since this is basically just a convenience feature for
  programmers, I think we can keep it simple. What examples of use did
  you have in mind?

- for set_documentdir, as far as I know the answer is documentdir for
  everybody except WIN32. You can thus simplify the #if cascade.

- in general, there is AFAIK no need for special casing EMX and Cygwin
  in directory selection, since they use a unix-like layout. The only
  thing to look for are file name conversions.

- I am not sure that there is a need to catter for multiple
  directories in HOME. So I doubt that you should use GetEnvPath in
  set_homedir. What you could do however, is test for the existence of
  the directory and revert to some default when it does not exist (or
  abort). This would handle the case of multiple directories.

- in set_tmpdir(), you can use GetTempPath for WIN32. See:
  
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/gettemppath.asp

  For OSX I would suggest to use FSFindFolder:
  
http://developer.apple.com/documentation/Carbon/Reference/Folder_Manager/folder_manager_ref/function_group_2.html#//apple_ref/doc/uid/TP30000238/F16387
  with folder type kChewableItemsFolderType (first choice) or
  kTemporaryFolderType as a second choice. (I know nothing about that,
  I just searched the Apple site)

- in set_system_lyxdir() I think that the code should be refactored to
  that the steps 3 and 4 are made posix-only and the windows and osx
  code use simpler alternatives: 

  For LyX/Aqua, use the code given here:
  http://doc.trolltech.com/3.3/mac-differences.html#7-1

  For LyX/Win, use the directory which holds the binary

- in set_default_user_lyxdir(), I would use for OSX FSFinfFolder with
  type kPreferencesFolderType.

- in extract_env_var_dir, I think using GetEnvPath is wrong, since we
  do not need to catter for the case of multiple paths. I guess
  GetEnv+os::internal_path is enough.

- as for other cases, I do not think that
  possible_relative_localedir() is useful. The windows and OSX cases
  should be straightforward, and the more subtle case should be used
  with posix only.


Finally, I would propose to change the conditionals in the following
way: just assume that config.h defines one of the following:
- USE_WIN_PACKAGING for LyX/Win (probably equivalent to _WIN32)
- USE_OSX_PACKAGING for LyX/Mac
- USE_POSIX_PACKAGING otherwise (linux, cygwin, darwin, emx)

I think this will make the code much clearer.

Also, an advantage of avoiding the symlink following code on win32 is
that it will avoid a case of using posix-only features (lstat) on a
system that lacks them.

I hope you find these remarks useful.

JMarc

Reply via email to