Skip to content

Commit 6ae5cbc

Browse files
committed
There were some issues with handling interpreters
1 parent 58b23c2 commit 6ae5cbc

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ Release/
3333
*.sublime-workspace
3434
.OpenIDE/active.profile
3535
oi-definitions.json
36+
local-deploy.sh

OpenIDE.Core/Configs/Interpreters.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Reflection;
55
using System.Collections.Generic;
66
using OpenIDE.Core.Config;
7+
using OpenIDE.Core.Logging;
78

89
namespace OpenIDE.Core.Configs
910
{
@@ -13,14 +14,10 @@ public class Interpreters
1314
private Dictionary<string,string> _interpreters = new Dictionary<string,string>();
1415

1516
public Interpreters(string token) {
17+
Logger.Write("Initializing interpreters");
1618
_token = token;
17-
var local = new Configuration(_token, false);
18-
var global =
19-
new Configuration(
20-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
21-
, false);
22-
readInterpreters(local);
23-
readInterpreters(global);
19+
var reader = new ConfigReader(_token);
20+
readInterpreters(reader);
2421
}
2522

2623
public string GetInterpreterFor(string extension) {
@@ -30,9 +27,9 @@ public string GetInterpreterFor(string extension) {
3027
return null;
3128
}
3229

33-
private void readInterpreters(Configuration config) {
30+
private void readInterpreters(ConfigReader config) {
3431
var prefix = "interpreter.";
35-
foreach (var interpreter in config.GetSettingsStartingWith(prefix)) {
32+
foreach (var interpreter in config.GetStartingWith(prefix)) {
3633
if (interpreter.Key.Length <= prefix.Length)
3734
continue;
3835

@@ -51,17 +48,19 @@ private void readInterpreters(Configuration config) {
5148
path.Replace("/", "\\");
5249
}
5350
if (!File.Exists(path)) {
54-
path =
51+
var modifiedPath =
5552
System.IO.Path.Combine(
5653
System.IO.Path.GetDirectoryName(
5754
Assembly.GetExecutingAssembly().Location),
5855
path);
59-
if (!File.Exists(path))
60-
continue;
56+
if (File.Exists(path))
57+
path = modifiedPath;
6158
}
62-
if (!_interpreters.ContainsKey(extension))
59+
if (!_interpreters.ContainsKey(extension)) {
60+
Logger.Write("Adding interpreter: " + path + " for " + extension);
6361
_interpreters.Add(extension, path);
62+
}
6463
}
6564
}
6665
}
67-
}
66+
}

OpenIDE.Core/CoreExtensions/ProcessExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@ private static bool handleOiLnk(ref string command, ref string arguments,
229229
private static bool prepareInterpreter(ref string command, ref string arguments) {
230230
var interpreter = GetInterpreter(command);
231231
if (interpreter != null) {
232-
command = interpreter;
233232
arguments = "\"" + command + "\" " + arguments;
233+
command = interpreter;
234234
return true;
235235
}
236236
return false;

0 commit comments

Comments
 (0)