Abdelrazak Younes wrote: > Abdelrazak Younes a écrit : >> #include <unistd.h> >> >> bool isCygwin() >> { >> return access("/cygdrive", F_OK) == 0; >> } >> >> Just for confirmation, is /cygdrive is present on any cygwin >> installation? But in the special case where a user has a c:\cygdrive and >> lyx is installed on the same drive, this test doesn't work (I just made >> the test). Is there any other way? > > "/usr/bin/cygstart.exe" seems to be a good candidates... Any objection > if I replace the #ifdef with this test in the Qt4 frontend?
Please not. This is a hack. It is not impossible to have a /usr/bin/cygstart.exe on any unix box. Then your test will fail. I don't understand what is wrong with an #ifdef? I personally prefer always compiletime checks rather than runtime checks if it is possible. Why do a hackish runtime test if the same thing can be achieved at compile time? Of course the #ifdefs should not be scattered around, but isolated in few utility functions. For this reason we have introduced the various ...path() functions, and this works quite well. I did not yet have time to comment on Enricos patch, I just had a quick look and the cygwin ifdefs he introduced in frontends/qt2/FileDialog.C don't seem right. If they are really needed (which I doubt currently, but that may change after reading the whole patch) we should introduce just another patch function. That way, we get nice clean code and the ugly stuff is banned to few files in src/support. Georg