@nativescript/windows 0.1.0-alpha.6 → 0.1.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/framework/__PROJECT_NAME__/RuntimeHost.cs +51 -14
- package/framework/libs/arm64/nativescript.dll +0 -0
- package/framework/libs/devtools/arm64/nativescript.dll +0 -0
- package/framework/libs/devtools/x64/nativescript.dll +0 -0
- package/framework/libs/x64/nativescript.dll +0 -0
- package/package.json +1 -1
|
@@ -139,30 +139,63 @@ namespace __PROJECT_NAME__
|
|
|
139
139
|
private static string ResolveEntryScriptPath()
|
|
140
140
|
{
|
|
141
141
|
var baseDir = AppContext.BaseDirectory;
|
|
142
|
-
|
|
143
|
-
var
|
|
144
|
-
|
|
142
|
+
// EXE lives in <project>/bin/; webpack bundle lives in <project>/app/.
|
|
143
|
+
var parentDir = Path.GetDirectoryName(
|
|
144
|
+
baseDir.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar))
|
|
145
|
+
?? baseDir;
|
|
145
146
|
|
|
146
|
-
|
|
147
|
-
|
|
147
|
+
// Candidate app directories: sibling of bin/ first, then directly under baseDir.
|
|
148
|
+
var appDirCandidates = new[]
|
|
149
|
+
{
|
|
150
|
+
Path.Combine(parentDir, "app"),
|
|
151
|
+
Path.Combine(parentDir, "App"),
|
|
152
|
+
Path.Combine(baseDir, "app"),
|
|
153
|
+
Path.Combine(baseDir, "App"),
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
string packageJsonPath = null;
|
|
157
|
+
string resolvedBaseDir = null;
|
|
158
|
+
foreach (var dir in appDirCandidates)
|
|
159
|
+
{
|
|
160
|
+
var candidate = Path.Combine(dir, "package.json");
|
|
161
|
+
if (File.Exists(candidate))
|
|
162
|
+
{
|
|
163
|
+
packageJsonPath = candidate;
|
|
164
|
+
resolvedBaseDir = dir;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Also accept package.json at the project root (parent of bin/).
|
|
170
|
+
if (packageJsonPath == null && File.Exists(Path.Combine(parentDir, "package.json")))
|
|
171
|
+
{
|
|
172
|
+
packageJsonPath = Path.Combine(parentDir, "package.json");
|
|
173
|
+
resolvedBaseDir = parentDir;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
string Fallback() =>
|
|
177
|
+
appDirCandidates.Select(d => Path.Combine(d, "bundle.js")).FirstOrDefault(File.Exists);
|
|
178
|
+
|
|
179
|
+
if (packageJsonPath == null)
|
|
180
|
+
return Fallback();
|
|
148
181
|
|
|
149
182
|
try
|
|
150
183
|
{
|
|
151
184
|
var config = ParsePackageConfig(packageJsonPath);
|
|
152
185
|
if (!string.IsNullOrWhiteSpace(config.WindowsMain))
|
|
153
186
|
{
|
|
154
|
-
var p = ResolveScriptPath(
|
|
187
|
+
var p = ResolveScriptPath(resolvedBaseDir, config.WindowsMain);
|
|
155
188
|
if (p != null) return p;
|
|
156
189
|
}
|
|
157
190
|
if (!string.IsNullOrWhiteSpace(config.Main))
|
|
158
191
|
{
|
|
159
|
-
var p = ResolveScriptPath(
|
|
192
|
+
var p = ResolveScriptPath(resolvedBaseDir, config.Main);
|
|
160
193
|
if (p != null) return p;
|
|
161
194
|
}
|
|
162
195
|
}
|
|
163
196
|
catch { }
|
|
164
197
|
|
|
165
|
-
return
|
|
198
|
+
return Fallback();
|
|
166
199
|
}
|
|
167
200
|
|
|
168
201
|
private static RuntimePackageConfig ParsePackageConfig(string packageJsonPath)
|
|
@@ -181,12 +214,16 @@ namespace __PROJECT_NAME__
|
|
|
181
214
|
{
|
|
182
215
|
if (string.IsNullOrWhiteSpace(scriptPath)) return null;
|
|
183
216
|
var normalized = scriptPath.Replace('/', Path.DirectorySeparatorChar);
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
217
|
+
foreach (var candidate in new[] { normalized, normalized + ".js" })
|
|
218
|
+
{
|
|
219
|
+
var direct = Path.IsPathRooted(candidate) ? candidate : Path.Combine(baseDir, candidate);
|
|
220
|
+
if (File.Exists(direct)) return direct;
|
|
221
|
+
var appLower = Path.Combine(baseDir, "app", candidate);
|
|
222
|
+
if (File.Exists(appLower)) return appLower;
|
|
223
|
+
var appUpper = Path.Combine(baseDir, "App", candidate);
|
|
224
|
+
if (File.Exists(appUpper)) return appUpper;
|
|
225
|
+
}
|
|
226
|
+
return null;
|
|
190
227
|
}
|
|
191
228
|
|
|
192
229
|
public void Dispose()
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|