Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | # NOTE: Derived from blib/lib/Inline.pm. |
2 | # Changes made here will be lost when autosplit is run again. | |
3 | # See AutoSplit.pm. | |
4 | package Inline; | |
5 | ||
6 | #line 1235 "blib/lib/Inline.pm (autosplit into blib/lib/auto/Inline/find_temp_dir.al)" | |
7 | #============================================================================== | |
8 | # Find the 'Inline' directory to use. | |
9 | #============================================================================== | |
10 | my $TEMP_DIR; | |
11 | sub find_temp_dir { | |
12 | return $TEMP_DIR if $TEMP_DIR; | |
13 | ||
14 | my ($temp_dir, $home, $bin, $cwd, $env); | |
15 | $temp_dir = ''; | |
16 | $env = $ENV{PERL_INLINE_DIRECTORY} || ''; | |
17 | $home = $ENV{HOME} ? abs_path($ENV{HOME}) : ''; | |
18 | ||
19 | if ($env and | |
20 | -d $env and | |
21 | -w $env) { | |
22 | $temp_dir = $env; | |
23 | } | |
24 | elsif ($cwd = abs_path('.') and | |
25 | $cwd ne $home and | |
26 | -d File::Spec->catdir($cwd,".Inline") and | |
27 | -w File::Spec->catdir($cwd,".Inline")) { | |
28 | $temp_dir = File::Spec->catdir($cwd,".Inline"); | |
29 | } | |
30 | elsif (require FindBin and | |
31 | $bin = $FindBin::Bin and | |
32 | -d File::Spec->catdir($bin,".Inline") and | |
33 | -w File::Spec->catdir($bin,".Inline")) { | |
34 | $temp_dir = File::Spec->catdir($bin,".Inline"); | |
35 | } | |
36 | elsif ($home and | |
37 | -d File::Spec->catdir($home,".Inline") and | |
38 | -w File::Spec->catdir($home,".Inline")) { | |
39 | $temp_dir = File::Spec->catdir($home,".Inline"); | |
40 | } | |
41 | elsif (defined $cwd and $cwd and | |
42 | -d File::Spec->catdir($cwd,"_Inline") and | |
43 | -w File::Spec->catdir($cwd,"_Inline")) { | |
44 | $temp_dir = File::Spec->catdir($cwd,"_Inline"); | |
45 | } | |
46 | elsif (defined $bin and $bin and | |
47 | -d File::Spec->catdir($bin,"_Inline") and | |
48 | -w File::Spec->catdir($bin,"_Inline")) { | |
49 | $temp_dir = File::Spec->catdir($bin,"_Inline"); | |
50 | } | |
51 | elsif (defined $cwd and $cwd and | |
52 | -d $cwd and | |
53 | -w $cwd and | |
54 | _mkdir(File::Spec->catdir($cwd,"_Inline"), 0777)) { | |
55 | $temp_dir = File::Spec->catdir($cwd,"_Inline"); | |
56 | } | |
57 | elsif (defined $bin and $bin and | |
58 | -d $bin and | |
59 | -w $bin and | |
60 | _mkdir(File::Spec->catdir($bin,"_Inline"), 0777)) { | |
61 | $temp_dir = File::Spec->catdir($bin,"_Inline"); | |
62 | } | |
63 | ||
64 | croak M56_no_DIRECTORY_found() | |
65 | unless $temp_dir; | |
66 | return $TEMP_DIR = abs_path($temp_dir); | |
67 | } | |
68 | ||
69 | # end of Inline::find_temp_dir | |
70 | 1; |