octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MSVC compiler support [patch 27]: OCTAVE_HOME


From: Michael Goffioul
Subject: MSVC compiler support [patch 27]: OCTAVE_HOME
Date: Tue, 17 Oct 2006 21:58:10 +0200
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

Defines OCTAVE_HOME automatically, allowing the full installed package to be
relocated in another directory
Index: src/octave.cc
===================================================================
RCS file: /cvs/octave/src/octave.cc,v
retrieving revision 1.226
diff -p -c -r1.226 octave.cc
*** src/octave.cc       15 Sep 2006 14:34:57 -0000      1.226
--- src/octave.cc       17 Oct 2006 11:07:42 -0000
*************** octave_main (int argc, char **argv, int 
*** 505,510 ****
--- 505,521 ----
  {
    octave_env::set_program_name (argv[0]);
  
+ #ifdef _MSC_VER
+   char buffer[1024];
+   if (GetModuleFileName(NULL, buffer, 1024) > 0)
+   {
+     std::string exec_dir = buffer;
+     int pos = exec_dir.rfind("\\bin\\");
+     if (pos != NPOS)
+       octave_env::putenv(std::string("OCTAVE_HOME"), exec_dir.substr(0, pos));
+   }
+ #endif
+ 
    octave_program_invocation_name = octave_env::get_program_invocation_name ();
    octave_program_name = octave_env::get_program_name ();
  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]