开发者

Configuring Eclipse .classpath for two different paths for the same entry

开发者 https://www.devze.com 2023-01-16 17:52 出处:网络
I\'m wondering if there is a way (in Windows 7) to make some sort of mapping of drives so that sometimes you find the files in a network drive and sometimes you find them in a local map?

I'm wondering if there is a way (in Windows 7) to make some sort of mapping of drives so that sometimes you find the files in a network drive and sometimes you find them in a local map?

-And to be able to easily switch between those two.

The reason I want to do this is that I want to be able to work (as a developer, using Eclipse for Java) partly at work, where I have certain library files in a network drive, and partly on the train, where I can't access the internet, so then I need to have those library files in a local m开发者_如何学运维ap on my laptop.

In my Eclipse projects I point out those library files using their whole file paths, and it's a lot of files and a lot of projects and I don't want to be forced to change every single filepath just because I'm temporarily working from a train.

I'm thinking that it would be great if I could map the same drive (say, drive "S"), so that it could either point to the place at the network or to a local map, depending on some easy switching.

How would you configure your environment in order to not change anything in your Eclipse project?


You could try SUBST

SUBST, substitute a drive letter for a network or local path. It basically creates a virtual drive with a local or a global (making this phrase sound more programmer-like) path.

Syntax:
      SUBST drive_letter: path //set the virtual drive path
      SUBST drive_letter: /D   //delete the drive

Another site!


You could reference a those two paths on the same virtual drive with "subst".

That way, 'S:\' could refer to two different paths depending on your current workstation.

On workstation1:

subst S: c:\path1\to\files

On workstation2:

subst S: c:\path2\to\files

On your .classpath in both cases:

S:\yourFiles


Thank you for your answers, but I didn't really like 'subst', since the removal of the drive seemed to "remove the drive letter", so it couldn't be used again until I had restarted my computer.

A colleague of mine had found a solution that was just what I was looking for: Two VBScript files: One for changing the drive mapping to a local (but shared) folder, and one for changing to the remote folder. The files look like this:

Set objNetwork = CreateObject("WScript.Network")
on error resume next:
objNetwork.RemoveNetworkDrive "N:" , true, true
objNetwork.MapNetworkDrive "N:", "\\MYCOMPUTER\SHARED"

-This code is for changing to the local folder, but in the other file you just change the file path to the remote one.

Maybe this can help someone else who's having the same problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消