Avatar of ElrondCT
ElrondCTFlag for United States of America

asked on 

Determine whether a folder is on the local computer

My VB 2008 application has configuration files which may be stored either locally or in a server folder. However, if they're stored on the server, the issue arises that a laptop might be used when the server is not accessible. I want to have a fallback process that will determine, if the file is not found (that is, if File.Exists returns False), if it's looking for a server location; if so, I would assume that the server is inaccessible and check a secondary location for the configuration information. If we're looking at the local computer, then I would assume the file doesn't exist, either because it's a new installation or because someone wiped out the file, and I would reinitialize.

I'm not sure how to determine whether the folder location is on the local computer or a server. If it starts with a "\\", of course, that would be a strong indicator of a network location. But a drive letter other than C: is ambiguous; it could be a second physical or logical drive, or it could be a mapped network drive. Can you suggest a way to know whether it's local or network?
Visual Basic.NET

Avatar of undefined
Last Comment
ElrondCT
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of ElrondCT
ElrondCT
Flag of United States of America image

ASKER

Thanks, Fernando. That does the trick.
Visual Basic.NET
Visual Basic.NET

Visual Basic .NET (VB.NET) is an object-oriented programming language implemented on the .NET framework, but also supported on other platforms such as Mono and Silverlight. Microsoft launched VB.NET as the successor to the Visual Basic language. Though it is similar in syntax to Visual Basic pre-2002, it is not the same technology,

96K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo