leading colons

General development discussion.

Moderators: Susan Smith, admin, Gabriel

John
Posts: 523
Joined: Sun Apr 26, 2009 8:27 am
Location: West Orange, NJ
Contact:

leading colons

Postby John » Thu Jan 18, 2018 10:12 am

Question 1:
What does the second colon do in this path:

@::\\server\resource\file.txt

From client/server installations I can not see @:\\server\resource\file.txt (even though the location is accessible via windows) but I can see @::\\server\resource\file.txt.
My logic dynamically adds the @: if it is client/server and not if it isn't.

Question 2:
If I add a leading colon to paths like C:\path\file.txt and \\server\resource\file.txt will it still work in the Non-Client/Server world? Or is there ever a time when I would want @: without the second colon in client/server? Could I just make my logic add @:: instead of @: or would this break somethings.

For reference my programs always use full paths and never use mapped BR Drives except for to locate my own internal .br type programs, so they never include the @: special logic.
John Bowman

bluesfannoz
Posts: 246
Joined: Fri Jun 19, 2009 9:01 am
Location: Topeka, Kansas
Contact:

Re: leading colons

Postby bluesfannoz » Thu Jan 18, 2018 10:31 am

Question 1: @:: usually means your referencing the OS path rather than the BR Path. With only the single colon your referencing the BR Path.

Question 2: That will depend upon whether your code is expecting to be working with the actual OS path or the BR Path.
Steve Koger
Computer Specialist
SEKESC-MACS Division

Gabriel
Posts: 370
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Re: leading colons

Postby Gabriel » Thu Jan 18, 2018 11:09 am

"@:" means a client path.
"@::" means a client path starting from the root.
"" means a server side path.
":" means a server side path starting from the root.

All four of those work in non-client server mode. The extra ":" has been around for years.

In non-CS mode the "@:" is ignored. The second ":" is still important.


Examples:
(Assuming you had a drive statement like:
DRIVE M:,C:\Application,.,\


":C:\MyFolder\" would refer to the path that is the absolute path C:\MyFolder on your server (if CS) or on your computer (if non-CS).
"@::C:\MyFolder\" would refer to the path that is the absolute path C:\MyFolder on your client (if CS) or on your computer (if non-CS)
":M:\Backups\SageLive" would refer to the path that is the absolute path M:\Backups\SageLive on your server (if CS) or on your computer (if non-CS)
"M:\Backups\SageLive" would refer to the path that is the absolute path C:\Application\Backups\SageLive on your server (if CS) or on your computer (if non-CS).
"@::M:\Bob" would refer to the path that is the absolute path M:\Bob on your client (if CS) or on your computer (if non-CS)
"@:Debra" would refer to the path that is the current directory of your application on the client with a subfolder of Debra. Say your client is installed in "C:\BRClient" and you didn't do any client side "CD" then this would be referring to a folder called "C:\BRClient\Debra"

"@::Debra" and say your client was installed in the same "C:\BRClient" folder would be referring to a folder called "C:\Debra". The second ":" means don't use Current Directory and instead start at the root of the current drive. The "@:" means (if client server, use the client).

the functions OS_FileName$ and BR_FileName$ are very useful for converting between BR paths and OS paths.

say you have the drive statement listed above, and you say

print Os_FileName$("M:\bob\file.txt")

it will print:
C:\Application\bob\file.txt.

print os_filename$(":M:\bob\file.txt")

it will print:
M:\bob\file.txt

print br_filename$("C:\Application\Debra.txt")

it will print:
M:Debra.txt

print br_filename$("C:\OtherFolder\Susan.txt")

it will print
:C:\OtherFolder\Susan.txt


Does that all make sense?

Gabriel

John
Posts: 523
Joined: Sun Apr 26, 2009 8:27 am
Location: West Orange, NJ
Contact:

Re: leading colons

Postby John » Thu Jan 18, 2018 12:01 pm

Thanks guys!
Yes, it all made sense. I couldn't figure out why I needed the second colon to make an full unc path to work in client/server but not in regular BR. I believe it was trying to auto-translate it into a relative path and auto-remove the extra \ (at least it thought it was extra). In my experience @: is not always ignored by non-client/server so I include it with an environment variable instead when I need it. So FOR ME - I can just add a second : to my environment variable and fix it everywhere. Thanks again.
John Bowman

Gabriel
Posts: 370
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Re: leading colons

Postby Gabriel » Thu Jan 18, 2018 12:05 pm

What was confusing is that on non-CS mode, the ":" is automatically added for you whenever the path you're specifying is not in one of your drive statements.

Whereas BR can't do that in CS because there are no client side drive statements, since the client could be anywhere over the internet or wherever and BR won't even know what paths are valid on the client.

Gabriel


Return to “General Development”

Who is online

Users browsing this forum: No registered users and 1 guest

cron