Skip to content

Commit

Permalink
Update MaximaSession.cs
Browse files Browse the repository at this point in the history
Fix pathing problem for linux
  • Loading branch information
fakemoses committed Jan 30, 2024
1 parent cfab4af commit ca3f29e
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions SessionManager/MaximaSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ public MaximaSession()
exprSMathToMaxima = new List<ExpressionStore>();
exprMaximaToSMath = new List<ExpressionStore>();
assemblyFolder = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
workingFolder = GlobalProfile.SettingsDirectory + @"extensions\plugins\44011c1e-5d0d-4533-8e68-e32b5badce41";

workingFolder = "";
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
workingFolder = GlobalProfile.SettingsDirectory + @"extensions\plugins\44011c1e-5d0d-4533-8e68-e32b5badce41";
else
workingFolder = GlobalProfile.SettingsDirectory + @"extensions/plugins/44011c1e-5d0d-4533-8e68-e32b5badce41";
gnuPlotImageFolder = System.IO.Path.Combine(workingFolder, "GnuPlot");
namedDrawImageFolder = System.IO.Path.Combine(workingFolder, "Images");
ConfigFileName = System.IO.Path.Combine(workingFolder, XMLname);
Expand Down Expand Up @@ -116,6 +121,7 @@ public void StartSession()
// Read Config and start Maxima if the config is uptodate and the maxima path is valid
if (File.Exists(ConfigFileName))
{
//do nothing
ReadConfig();
if (IsConfigFileFromCurrentPluginVersion() && File.Exists(pathToMAXIMA))
{
Expand Down Expand Up @@ -489,8 +495,8 @@ private void StartAndConnectMaxima(int option)
maximaProcess.StartInfo.FileName = "maxima";
// "-l sbcl" enforces Steel bank common lisp (because it is unicode-proof)
//sbcl does not work on version 5.45
maximaProcess.StartInfo.Arguments = " -l sbcl -s " + Convert.ToString(socket.GetPort());
//maximaProcess.StartInfo.Arguments = " -s " + Convert.ToString(socket.GetPort());
//maximaProcess.StartInfo.Arguments = " -l sbcl -s " + Convert.ToString(socket.GetPort());
maximaProcess.StartInfo.Arguments = " -s " + Convert.ToString(socket.GetPort());
}
maximaProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
maximaProcess.Start();
Expand Down Expand Up @@ -759,7 +765,7 @@ public void SaveConfig()
"load(vect)$",
"load(abs_integrate)$",
"setup_autoload(mnewton, mnewton)$",
"setup_autoload(draw, draw2d, draw3d)$",
//"setup_autoload(draw, draw2d, draw3d)$",
"load(lsquares)$",
//"setup_autoload(lsquares, lsquares_mse, lsquares_estimates_approximate)$",
"logb(x,y):=log(x)/log(y)$",
Expand Down Expand Up @@ -805,27 +811,20 @@ public void ReadConfig()
XmlInterface.readXmlALL(ConfigFileName, settings, commands, customCommands, exprSMathToMaxima, exprMaximaToSMath);
// Postprocessing
List<string> y = settings;
if (settings.Count == 6 && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
if (settings.Count == 6)
{
pathToMAXIMArel = settings[0];
FoundConfigFormatID = Convert.ToInt32(settings[1]);
majorV = Convert.ToInt32(settings[2]);
minorV = Convert.ToInt32(settings[3]);
buildV = Convert.ToInt32(settings[4]);
revisionV = Convert.ToInt32(settings[5]);
try
{
pathToMAXIMA = Path.Combine(GlobalProfile.ApplicationPath, pathToMAXIMArel);
}
catch { }

} else if (settings.Count == 5 && RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
FoundConfigFormatID = Convert.ToInt32(settings[0]);
majorV = Convert.ToInt32(settings[1]);
minorV = Convert.ToInt32(settings[2]);
buildV = Convert.ToInt32(settings[3]);
revisionV = Convert.ToInt32(settings[4]);
try
{
pathToMAXIMA = Path.Combine(GlobalProfile.ApplicationPath, pathToMAXIMArel);
}
catch { }

}
else FoundNoPath();
}
Expand Down

0 comments on commit ca3f29e

Please sign in to comment.