bug 14348: replug shell interaction on Windows 67/17767/4
Antoine ELIAS [Thu, 4 Feb 2016 15:44:34 +0000 (16:44 +0100)]
Change-Id: I4824dd7fb0df9d1342b4b31f536e8d6d30beac5f

scilab/CHANGES_6.0.X
scilab/modules/core/includes/InitScilab.h
scilab/modules/core/src/cpp/InitScilab.cpp
scilab/modules/core/tests/nonreg_tests/bug_14348.tst [new file with mode: 0644]
scilab/modules/startup/src/cpp/scilab.cpp
scilab/modules/windows_tools/src/c/CScilex/CScilex.vcxproj
scilab/modules/windows_tools/src/c/WScilex/WScilex.vcxproj
scilab/modules/windows_tools/src/c/scilab_windows/FilesAssociations.c

index 3b651b3..b842984 100644 (file)
@@ -83,6 +83,8 @@ Bug Fixes
 
 * Bug #14331 fixed - The third argument of lsq crashed Scilab.
 
+* Bug #14348 fixed - Scilab did not open sce/sci file from Windows explorer.
+
 Dependencies
 =============
 
index 306c6ef..f0d2007 100644 (file)
@@ -46,6 +46,7 @@ typedef struct
     int isPrioritary;
     int iStartConsoleThread;
     int iForceQuit;
+    int iCodeAction;
     enum command_origin_t iCommandOrigin;
 } ScilabEngineInfo;
 
index 7a8e410..8c4f5a8 100644 (file)
@@ -135,6 +135,7 @@ ScilabEngineInfo* InitScilabEngineInfo()
     pSEI->iForceQuit = 0;           // management of -quit argument
     pSEI->iCommandOrigin = NONE;
 
+    pSEI->iCodeAction = -1; //default value, no code action ( used on windows by file associations -O -X -P arguments)
     return pSEI;
 }
 
@@ -332,6 +333,13 @@ int StartScilabEngine(ScilabEngineInfo* _pSEI)
         }
         iMainRet = ConfigVariable::getExitStatus();
         iScript = 1;
+
+        if (_pSEI->iCodeAction != 0)
+        {
+            //alloc in main to manage shell interaction
+            FREE(_pSEI->pstExec);
+            _pSEI->pstExec = NULL;
+        }
     }
     else if (_pSEI->pstFile)
     {
diff --git a/scilab/modules/core/tests/nonreg_tests/bug_14348.tst b/scilab/modules/core/tests/nonreg_tests/bug_14348.tst
new file mode 100644 (file)
index 0000000..cc95f5e
--- /dev/null
@@ -0,0 +1,23 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2016 - Scilab Enterprises - Antoine ELIAS
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- Non-regression test for bug 14348 -->
+//
+// <-- WINDOWS ONLY -->
+//
+// <-- INTERACTIVE TEST -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/14348
+//
+// <-- Short Description -->
+// Scilab does not open sce/sci file in scilab correctly when calling by windows explorer ( double click on file )
+
+//open a Windows explorer and double click on a sce/sci file.
+//Scilab must be opened with scinotes and your selected file.
+//double click on another sce/sci file.
+//this file must be opened in the same Scilab, without launching a new one.
\ No newline at end of file
index cc58633..2fbabcf 100644 (file)
@@ -37,6 +37,8 @@ extern "C"
 
     extern char *getCmdLine(void);
 #ifdef _MSC_VER
+#include "FilesAssociations.h"
+#include "PATH_MAX.h"
     jmp_buf ScilabJmpEnv;
 #else
     extern jmp_buf ScilabJmpEnv;
@@ -180,6 +182,33 @@ static int get_option(const int argc, char *argv[], ScilabEngineInfo* _pSEI)
                 _pSEI->pstExec = argv[i];
             }
         }
+        else if (!strcmp("-O", argv[i]))
+        {
+            i++;
+            if (argc >= i)
+            {
+                _pSEI->pstExec = argv[i];
+                _pSEI->iCodeAction = 0;
+            }
+        }
+        else if (!strcmp("-X", argv[i]))
+        {
+            i++;
+            if (argc >= i)
+            {
+                _pSEI->pstExec = argv[i];
+                _pSEI->iCodeAction = 1;
+            }
+        }
+        else if (!strcmp("-P", argv[i]))
+        {
+            i++;
+            if (argc >= i)
+            {
+                _pSEI->pstExec = argv[i];
+                _pSEI->iCodeAction = 2;
+            }
+        }
         else if (!strcmp("-l", argv[i]))
         {
             i++;
@@ -305,6 +334,26 @@ int main(int argc, char *argv[])
         setScilabMode(SCILAB_STD);
         setScilabInputMethod(&ConsoleRead);
         setScilabOutputMethod(&ConsolePrintf);
+
+#ifdef _MSC_VER
+        if (pSEI->iCodeAction != -1)
+        {
+            //manage calls from explorer ( double click on sce file , ... )
+            char* Cmd = (char*)MALLOC(((PATH_MAX * 2) + 1) * sizeof(char));
+            strcpy(Cmd, "");
+            int ret = CommandByFileExtension(pSEI->pstExec, pSEI->iCodeAction, Cmd);
+
+            if (ret && Cmd[0] != '\0')
+            {
+                pSEI->pstExec = Cmd; //Cmd must be freed in StartScilabEngine after process.
+            }
+            else
+            {
+                pSEI->iCodeAction = -1;
+            }
+        }
+#endif
+
 #if defined(__APPLE__)
         return initMacOSXEnv(pSEI);
 #endif // !defined(__APPLE__)
index 14b185a..639fb99 100644 (file)
@@ -79,7 +79,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../../../core/src/c;../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../startup/src/c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../../core/src/c;../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../startup/src/c;../../../../windows_tools/src/c/scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;WITHOUT_GUI;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <ObjectFileName>$(Configuration)/</ObjectFileName>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../../../core/src/c;../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../startup/src/c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../../core/src/c;../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../startup/src/c;../../../../windows_tools/src/c/scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;WITHOUT_GUI;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <ObjectFileName>$(Configuration)/</ObjectFileName>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <AdditionalIncludeDirectories>../../../../core/src/c;../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../startup/src/c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../../core/src/c;../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../startup/src/c;../../../../windows_tools/src/c/scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;WITHOUT_GUI;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <ObjectFileName>$(Configuration)/</ObjectFileName>
     </Midl>
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <AdditionalIncludeDirectories>../../../../core/src/c;../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../startup/src/c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../../core/src/c;../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../startup/src/c;../../../../windows_tools/src/c/scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;WITHOUT_GUI;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <ObjectFileName>$(Configuration)/</ObjectFileName>
     <ProjectReference Include="..\..\..\..\output_stream\src\c\output_stream.vcxproj">
       <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\scilab_windows\scilab_windows.vcxproj">
+      <Project>{8028f371-6a94-4a26-8804-6e7f05f1d1aa}</Project>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\..\..\startup\src\cpp\scilab.cpp" />
index 62aa7af..69696a9 100644 (file)
@@ -78,7 +78,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../core/src/c;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../core/src/c;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <ObjectFileName>$(Configuration)/</ObjectFileName>
     </Midl>
     <ClCompile>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../core/src/c;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../core/src/c;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <ObjectFileName>$(Configuration)/</ObjectFileName>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <AdditionalIncludeDirectories>../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../core/src/c;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../core/src/c;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <ObjectFileName>$(Configuration)/</ObjectFileName>
     </Midl>
     <ClCompile>
       <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
-      <AdditionalIncludeDirectories>../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../core/src/c;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>../../../../../libs/intl;../../../../functions_manager/includes;../../../../console/includes;../../../../elementary_functions/includes;../../../../localization/includes;../../../../shell/includes;../../../../history_manager/includes;../../../../fileio/includes;../../../../output_stream/includes;../../../../string/includes;../../../../api_scilab/includes;../../../../threads/includes;../../../../core/src/c;../../../../dynamic_link/includes;../../../../tclsci/includes;../../../../jvm/includes;../../../../gui/includes;../../../../graphics/includes;../../../../core/includes;../../../../ast/includes/types;../../../../ast/includes/ast;../../../../ast/includes/analysis;../../../../ast/includes/exps;../../../../ast/includes/operations;../../../../ast/includes/symbol;../../../../ast/includes/system_env;../../../../windows_tools\src\c\scilab_windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <ObjectFileName>$(Configuration)/</ObjectFileName>
     <ProjectReference Include="..\..\..\..\output_stream\src\c\output_stream.vcxproj">
       <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project>
     </ProjectReference>
+    <ProjectReference Include="..\scilab_windows\scilab_windows.vcxproj">
+      <Project>{8028f371-6a94-4a26-8804-6e7f05f1d1aa}</Project>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\..\..\startup\src\cpp\scilab.cpp" />
index 6017c8f..0431d7d 100644 (file)
@@ -45,11 +45,11 @@ static BOOL IsASciNotesFileSCE(char *chainefichier);
 static BOOL IsASciNotesFileSCI(char *chainefichier);
 static BOOL IsASciNotesFileTST(char *chainefichier);
 /*--------------------------------------------------------------------------*/
-#define MSG_SCIMSG1 "%s -e load(getlongpathname('%s'));disp(getlongpathname('%s')+ascii(32)+'loaded');"
-#define MSG_SCIMSG2_XCOS "%s -e xcos(getlongpathname('%s'));"
+#define MSG_SCIMSG1 "load(getlongpathname('%s'));disp(getlongpathname('%s')+ascii(32)+'loaded');"
+#define MSG_SCIMSG2_XCOS "xcos(getlongpathname('%s'));"
 #define MSG_SCIMSG3_XCOS "execstr('xcos(getlongpathname(''%s''));','errcatch');"
-#define MSG_SCIMSG4 "%s -e exec(getlongpathname('%s'));"
-#define MSG_SCIMSG5_EDITOR "%s -e editor(getlongpathname('%s'));"
+#define MSG_SCIMSG4 "exec(getlongpathname('%s'));"
+#define MSG_SCIMSG5_EDITOR "editor(getlongpathname('%s'));"
 /* we try to launch scilab editor */
 #define MSG_SCIMSG6_EDITOR "execstr('editor(getlongpathname(''%s''));','errcatch');"
 #define MSG_SCIMSG7 "Scilab Communication"
@@ -132,8 +132,6 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd)
         BOOL bConverted = FALSE;
         char FinalFileName[(MAX_PATH * 2) + 1];
         char *ShortPath = NULL;
-        char PathWScilex[(MAX_PATH * 2) + 1];
-
 
         /* Recuperation du nom du fichier au format 8.3 */
         ShortPath = getshortpathname(fichier, &bConverted);
@@ -145,7 +143,6 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd)
             ShortPath = NULL;
         }
 
-        GetModuleFileName ((HINSTANCE)GetModuleHandle(NULL), PathWScilex, MAX_PATH);
         ReturnedValue = 1;
 
         switch (OpenCode)
@@ -155,29 +152,13 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd)
             {
                 if (!HaveAnotherWindowScilab() || haveMutexClosingScilab())
                 {
-                    if (with_module(L"scinotes"))
-                    {
-                        wsprintf(Cmd, MSG_SCIMSG5_EDITOR, PathWScilex, FinalFileName);
-                    }
-                    else
-                    {
-                        MessageBox(NULL, "Please install editor module.", "Error", MB_ICONSTOP);
-                        exit(0);
-                    }
+                    wsprintf(Cmd, MSG_SCIMSG5_EDITOR, FinalFileName);
                 }
                 else
                 {
                     char *ScilabDestination = NULL;
 
-                    if (with_module(L"scinotes"))
-                    {
-                        wsprintf(Cmd, MSG_SCIMSG6_EDITOR, FinalFileName);
-                    }
-                    else
-                    {
-                        MessageBox(NULL, "Please install editor module.", "Error", MB_ICONSTOP);
-                        exit(0);
-                    }
+                    wsprintf(Cmd, MSG_SCIMSG6_EDITOR, FinalFileName);
 
                     ScilabDestination = getLastScilabFound();
                     if (ScilabDestination)
@@ -188,15 +169,7 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd)
                     }
                     else
                     {
-                        if (with_module(L"scinotes"))
-                        {
-                            wsprintf(Cmd, MSG_SCIMSG5_EDITOR, PathWScilex, FinalFileName);
-                        }
-                        else
-                        {
-                            MessageBox(NULL, "Please install editor module.", "Error", MB_ICONSTOP);
-                            exit(0);
-                        }
+                        wsprintf(Cmd, MSG_SCIMSG5_EDITOR, FinalFileName);
                     }
                 }
             }
@@ -207,7 +180,7 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd)
                 if (IsABinOrSavFile(FinalFileName) == TRUE)
                 {
                     /* C'est un fichier .BIN ou .SAV d'ou load */
-                    wsprintf(Cmd, MSG_SCIMSG1, PathWScilex, FinalFileName, FinalFileName);
+                    wsprintf(Cmd, MSG_SCIMSG1, FinalFileName, FinalFileName);
                 }
                 else
                 {
@@ -216,29 +189,13 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd)
                         ExtensionFileIntoLowerCase(FinalFileName);
                         if (!HaveAnotherWindowScilab() || haveMutexClosingScilab())
                         {
-                            if (with_module(L"xcos"))
-                            {
-                                wsprintf(Cmd, MSG_SCIMSG2_XCOS, PathWScilex, FinalFileName);
-                            }
-                            else
-                            {
-                                MessageBox(NULL, "Please install xcos module.", "Error", MB_ICONSTOP);
-                                exit(0);
-                            }
+                            wsprintf(Cmd, MSG_SCIMSG2_XCOS, FinalFileName);
                         }
                         else
                         {
                             char *ScilabDestination = NULL;
 
-                            if (with_module(L"xcos"))
-                            {
-                                wsprintf(Cmd, MSG_SCIMSG3_XCOS, FinalFileName);
-                            }
-                            else
-                            {
-                                MessageBox(NULL, "Please install xcos module.", "Error", MB_ICONSTOP);
-                                exit(0);
-                            }
+                            wsprintf(Cmd, MSG_SCIMSG3_XCOS, FinalFileName);
 
                             ScilabDestination = getLastScilabFound();
                             if (ScilabDestination)
@@ -249,21 +206,13 @@ int CommandByFileExtension(char *fichier, int OpenCode, char *Cmd)
                             }
                             else
                             {
-                                if (with_module(L"xcos"))
-                                {
-                                    wsprintf(Cmd, MSG_SCIMSG2_XCOS, PathWScilex, FinalFileName);
-                                }
-                                else
-                                {
-                                    MessageBox(NULL, "Please install xcos module.", "Error", MB_ICONSTOP);
-                                    exit(0);
-                                }
+                                wsprintf(Cmd, MSG_SCIMSG2_XCOS, FinalFileName);
                             }
                         }
                     }
                     else
                     {
-                        wsprintf(Cmd, MSG_SCIMSG4, PathWScilex, FinalFileName);
+                        wsprintf(Cmd, MSG_SCIMSG4, FinalFileName);
                     }
                 }
             }