|
Previous Top Next |
Prototype: | (String pFile),String |
This method takes a filename as parameter and will return the appropriate UNC filename for it, no matter if it is a local file or a remote file (on another computer), using the enumeration functions to find the appropriate name. Note that if no UNC name can be established it will return the original name back, so this method should be 100% safe on standalone computers where there are no local or remote shares to connect to. In that case it will simply return the filename/path passed to it.
Example:
MyProc Proc
P String(255)
ITN ITNetworkClass
Code
P = 'c:\somepath\myfile.txt'
P = ITN.GetLocalNetworkFileName(P)
Message('P is now = ' & P)
P would now be '\\COMPAQ\TheCDrive\somepath\myfile.txt' if the computer name was "COMPAQ" and the local share name for the C:\ was "TheCDrive". If there was no local share, this would return "c:\somepath\myfile.txt" even if the computer name was still "COMPAQ" If you want to provide an option later on to convert to UNC, it would be advisable to store the computer name with the filename, that way the filename(s) could be fairly easily converted to UNC.
See also: