I'm only guessing here, but I think that the user that is running the script is not able to see the file, while the user that you are running the diagnostics under can. An easy way to diagnose this is to 'su' to that user and see if you can see those files in the shell. The harder way is to dump a readdir() listing to STDERR.

This might be because a single directory somewhere along that path is not mode 0755, but perhaps 0700 or somesuch. In order to get into the final directory, you have to enter each in turn.

As an aside, it is odd that you list the code $HOME/$gamedir/maps/$mapname.bsp in no fewer than three places in your code. If you were to change one, for whatever reason, the other two would be desynchronized (read: not working). A good idea is to warn with the actual thing you were testing, not a simulation.

In reply to Re: From chat to here :) chdir() and test -f issues. by tadman
in thread From chat to here :) chdir() and test -f issues. by snafu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.