lyt23 / filesync4eclipse

Automatically exported from code.google.com/p/filesync4eclipse
1 stars 0 forks source link

Allow environment variables in destination path #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Original request from Bob Swift:

I was wondering if there was any variable replacement capability in the 
default target specification.  For example, I would like to configure 
something like:

//server/share/${env_var:CLIENT}  or  //server/share/%CLIENT% where CLIENT 
is a system environment variable.  The reason for this is to make it 
simple to have a configuration shared with a team, where each team member 
needs to have a different CLIENT value. For instance, we could check in 
the configuration into source control.  It would also make it possible to 
for a single user to switch between different settings across a large 
number of projects (> 25) without going into each configuration 
separately.  Similarly, we would also configuration the server value as 
well.

Original issue reported on code.google.com by iloveeclipse on 7 Feb 2009 at 11:17

GoogleCodeExporter commented 8 years ago
There is already a possibility to specify a path variable defined in Eclipse 
for 
each client, see "Window ->Preferences ->General ->Workspace->Linked 
resources-> 
Defined path variables"
and
http://andrei.gmxhome.de/filesync/usage.html

Hovewer, you will need to enforce all your developers to add this variable 
manually 
in each workspace they use/create, which is not very friendly...

So I've added some experimental code in SVN for the path resolving/unresolving.

It will resolve //server/share/${env_var\:CLIENT}/data  to  
//server/share/andrei/
data
or
c:/${env_var\:CLIENT}/data/${env_var\:TODAY}   to   c:/andrei/data/20090131
or
${env_var\:TEMP}/blabla/${env_var\:USERNAME}  to  c:\temp\blabla\andrei

Basically everything "hardcoded" between the first and the last variable will 
be 
kept, the rest can be changed.

Please notice, that even if Eclipse uses ${name:value} format, because of 
encoding 
into/from properties file it should be written as ${name\:value}.

All kinds of variables supported by Eclipse variables extension point can be 
used.

Some reference info:
http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/
reference/api/org/eclipse/core/variables/package-summary.html

http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/
reference/extension-points/org_eclipse_core_variables_dynamicVariables.html

http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/
reference/extension-points/org_eclipse_core_variables_valueVariables.html

http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.user/
concepts/concepts-exttools.htm

http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.jdt.doc.user/referen
ce/
preferences/run-debug/ref-string_substitution.htm

Original comment by iloveeclipse on 7 Feb 2009 at 11:19

GoogleCodeExporter commented 8 years ago
Some new issues reported by Bob Swift:

1)    UI config:  If I specify 
//server/root/p4clients/X${env_var\:P4TOOLCLIENT}/
test and save, next time I look at the configuration it is turned into 
server/root/
p4clients/x${env_var/:\P4TOOLCLIENT}\test which does not work

2)    File config:  If I specify 
//server/root/p4clients/X${env_var\:P4TOOLCLIENT}/
test in the configuration file and start eclipse, then if I look in the UI I 
see 
that the configuration has been expanded to 
\\server\root\p4clients\xswiftb1\test 
<file:///\\server\root\p4clients\xswiftb1\test>  and this is correct and it 
works

3)    If I try to update the server to say newserver, typing is VERY slow, but 
eventually it works.  Checking the config file, it still includes the ${env_var
\:P4TOOLCLIENT}/ value.

Original comment by iloveeclipse on 7 Feb 2009 at 11:22

GoogleCodeExporter commented 8 years ago
Closing because it works now.

Original comment by iloveeclipse on 3 Apr 2009 at 9:27