[vtkusers] The filename+path in windows and linux

Leon Chen liming.leon at gmail.com
Thu Jul 21 21:15:43 EDT 2005


Hi everyone,

I am doing my project under windows(my laptop) and linux(the desktop
machine in school lab) using VTK.

In windows, I use MSVC++ 7; under linux, I just use the .cxx file,
ccmake it, then make, run. Since now there is only 1 cxx file, it is
quite straightforward to share the same source CPP source code between
these 2 different platform.

However, there are some problem.

First is the difference between VTK versions installed in the system.
It is troublesome because I have to modify some function to match the
different specification in different versions of VTK...

The second problem which is easier, and maybe I can get the answer here:

About the filename+path in different system.

When I use something such as

XXX->SetFileName( "G:\\Project\\Data\\04548d144.vtk" ); 

in windows, I can use '\\' or '/' as separator.

In linux, it should be 

XXX->SetFileName( "/homes/lc04/Project/Data/04548d144.vtk" );


Now I just want to keep the code exactly the same, so I need not
modify this line (or many similar lines) when the OS is switched.

I know I can use VTK_DATA env, but is it possible to use this system
env via the SAME code both in linux AND windows? If it possible, how
can i do it? I found some code, but there are different in win and
linux...

BTW, in tcl it is so easy, just use $VTK_DATA, problems solved. but in CPP...


hope someone who has the experience can reply me....

Many thanks!!!



Leon



More information about the vtkusers mailing list