Accessing files on a local network file server - BEST PRACTICE?
Paul Dupuis
paul at researchware.com
Fri Sep 25 15:13:36 EDT 2020
On 9/25/2020 2:42 PM, J. Landman Gay via use-livecode wrote:
> I know very little about Windows network addresses, but from the
> example you gave, I'd check to see if (slash-delimited) item 1 of the
> path is a single letter followed by a colon.
>
Thanks for thought.
In a Windows server environment (i.e many corporation, government
agencies, etc.), computer are often set so tat their specific "User"
directories (Documents, Desktop, "Home", etc.) at on a server rather
than local disk. So a path to a file called "somefile.txt" is a user's
Documents folder looks like:
//s1.somedomain.com/mountPoint/<username>/Documents/somefile.txt
The question is, if you execute the line of LiveCode script:
if there is a file
"//s1.somedomain.com/mountPoint/<username>/Documents/somefile.txt" then
-- true
else
-- false
end if
In the "true" case, the file is there, which means the server and
network are both accessible. Yea! proceed with whatever.
In the "false" case, you do not know whether the FILE is missing OR the
NETWORK is disconnected or the SERVER is down.
It is in the "false" case that I am looking for approaches (if there are
any) to tell the difference between
1) the file is missing
and
2) the network or server is down.
Bernard has a suggestion of keeping an invisible file. Being hidden, it
is unlike that it could be removed by intent or accident and so, if the
file I am looking for "somefile.txt" does not exists, I could test for
the hidden file. If that exists, I know my file is missing and the
server and network are still up. If the hidden file also does not
exists, the server or network is "probably" down.
I could probably improve on Bernard's suggestion by testing for:
if there is a folder "//s1.somedomain.com/mountPoint/<username>" then
-- the server is up
else
-- the server or network is down OR or the user has been fired and
their account delete!
end if
I was hoping someone out there had actually dealt with LiveCode working
with files on a Windows network server and have a definite approach.
Maybe testing for the user's folder is the definitive way OR the
mountPoint folder may be even better?
-- Paul
More information about the use-livecode
mailing list