]> git.lyx.org Git - lyx.git/blobdiff - lib/reLyX/reLyX.in
clean up french language handling
[lyx.git] / lib / reLyX / reLyX.in
index d20b78590c50522a8f3bffbf8083c1bfe0d54cec..44a526de44f2f0202dbd725e9688c00fcfb1c193 100644 (file)
@@ -14,11 +14,13 @@ $^W = 1; # same as 'perl -w'
 use vars qw($lyxdir $lyxname);
 
 my (@maybe_dir);
-my $mainscript = "reLyXmain.pl";
+my $mainscript;
 my $relyxdir;
 
 # Do this in a BEGIN block so it's done before the 'use lib' below
 BEGIN{
+# Variables may not be assigned before the BEGIN block
+$mainscript = "reLyXmain.pl";
 # This points to LyX library dir, e.g. /usr/local/share/lyx
 $lyxdir = "@LYX_DIR@";
 # This is just "." if you compiled from the source directory
@@ -33,17 +35,19 @@ my $dir = &dirname($name);
 
 # Create a list of possible directories to look in. Non-existent directories
 #    are OK, but empty or undefined values will make 'use lib' complain
-my $i = 0;
+
 # case 1: for developers, e.g. - reLyX and $mainscript in same directory
-$maybe_dir[$i++] = "$dir";
+push @maybe_dir, "$dir";
 # case 2: ran make but not make install.
-$maybe_dir[$i++] = "$dir/$srcdir";
-# case 3: environment variable LYX_DIR_11x has been set
-if (exists $ENV{LYX_DIR_11x}) { $maybe_dir[$i++] = "$ENV{LYX_DIR_11x}/reLyX"};
+push @maybe_dir, "$dir/$srcdir";
+# case 3: environment variable LYX_DIR_14x has been set
+if (exists $ENV{LYX_DIR_14x}) { push @maybe_dir, "$ENV{LYX_DIR_14x}/reLyX"};
 # case 4: e.g., reLyX in /opt/bin, $mainscript in /opt/share/lyx/reLyX
-$maybe_dir[$i++] = "$dir/../share/$lyxname/reLyX"; # case 4
-# case 5: configure figured out where $mainscript is
-$maybe_dir[$i++] = "$lyxdir/reLyX";
+push @maybe_dir, "$dir/../share/$lyxname/reLyX"; # case 4
+# case 5: LyX/Mac -- reLyX is in a MacOS X application bundle
+push @maybe_dir, "$dir/../Resources/LyX/reLyX"; # case 5
+# case 6: configure figured out where $mainscript is
+push @maybe_dir, "$lyxdir/reLyX";
 
 # Decide which one is the real directory, based on the existence of
 #    "$dir/$mainscript"
@@ -55,12 +59,14 @@ foreach $dir (@maybe_dir) {
        $found = 1;
        last;
     }
- }
+}
 
 if(!$found) {
     print "reLyX directory not found.\n";
     exit(1);
- } 
+} else { ##just for debug purpose, remove for stable version
+    print "reLyX directory is: $relyxdir\n";
+}
 
 } # end BEGIN block