Author Topic: Can I get the UNC path for a buffer?  (Read 3277 times)

James Cutler

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Can I get the UNC path for a buffer?
« on: May 17, 2007, 10:34:57 am »
p_buf_name gives me the full file path with the mapped drive letter (e.g., z:\temp\test.txt).  Is there an easy way to get the UNC path name (e.g., \\computer\share\test.txt)?

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 739
  • Hero Points: 47
Re: Can I get the UNC path for a buffer?
« Reply #1 on: May 20, 2007, 05:09:19 am »
Use NTNetGetConnection() like this:

#if __NT__
_str netShareName = NTNetGetConnection(localDriveWithColon);
#endif

There is no online help for this api, so hopefully my variable names are self-explanatory.

Note that __NT__ preprocesses for Windows platforms, and __UNIX__ preprocesses for UNIX/Mac platforms. If you wanted to be more specific about the platform you would use machine().

--rodney
« Last Edit: May 20, 2007, 05:12:45 am by Rodney »