common path names

G

Guest

Is there a way to create a path name so that it does not have to change when
referencing a file locally? I'm using UNC names to avoid the problems with
drive relative names but I have to change the path name to reference the file
locally. E.g.

\\G4\CognosDev\Logs\log file.txt - network reference
C:\CognosDev\Logs\log file.txt - local reference

I've tried using the . file name to refer to the current directory without
success. I'd like to use a common path name that will point to either a local
drive or the network drive depending on where the file is referenced. Is this
possible?

Thanks,
Tom
 
P

Pegasus \(MVP\)

c62ip64 said:
Is there a way to create a path name so that it does not have to change when
referencing a file locally? I'm using UNC names to avoid the problems with
drive relative names but I have to change the path name to reference the file
locally. E.g.

\\G4\CognosDev\Logs\log file.txt - network reference
C:\CognosDev\Logs\log file.txt - local reference

I've tried using the . file name to refer to the current directory without
success. I'd like to use a common path name that will point to either a local
drive or the network drive depending on where the file is referenced. Is this
possible?

Thanks,
Tom

You can use \\G4\CognosDev\Logs\log file.txt locally or
remotely - it will always refer to the same file.
 
G

Guest

I do not want to use \\G4\CognosDev\Logs\log file.txt locally. I want to use
a local file without impacting the remote file. I'm asking this to avoid
having to modify the path name when testing application changes locally.

Thanks,
Tom
 
G

Guest

The following path names are used in a SQL Server application for logging and
to specify a data link connection:

\\G4\CognosDev\Logs\log file.txt
\\G4\CognosDev\Admin\ETRPTG01 Data Link.udl

I copy the application to a local instance for modifications and testing.
When testing these modifications, I do not want to create log entries on the
remote server file and I have my own data link file to connect to a local
instance of the data base. I change the path names to the following prior to
testing the modifications.

C:\CognosDev\Logs\log file.txt
C:\CognosDev\Admin\ETRPTG01 Data Link.udl

The only problem with this approach is that I and any other developer
working on modifications have to remember to change the path names back to
the UNC names prior to moving the modifications to the production server. I'm
looking to use a common path name that does not have to change when testing
modifications. The application would reference the files either on the remote
server for production or locally when testing modifications.

Thanks,
Tom
 
P

Pegasus \(MVP\)

If you application is smart enough to detect the name of your current
platform then you can get it to do something line this, here written in
batch file format:

if /i "%ComputerName%"=="TestPC" (set Source=C:) else (set Source=\\G4)
%Source%\CognosDev\Logs\log file.txt
%Source%\CognosDev\Admin\ETRPTG01 Data Link.udl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top