// Do the file reading and compression in parallel
Action<string> body = delegate (string url) {
- string fname = new Uri (url).LocalPath;
+ string fname = LocateFile (new Uri (url).LocalPath);
Stream stream = File.OpenRead (fname);
long real_size = stream.Length;
// The non-parallel part
byte [] buffer = new byte [8192];
foreach (var url in files) {
- string fname = new Uri (url).LocalPath;
+ string fname = LocateFile (new Uri (url).LocalPath);
string aname = Path.GetFileName (fname);
string encoded = aname.Replace ("-", "_").Replace (".", "_");
foreach (string include in includes)
compilerArgs.Add(String.Format ("/I {0}", quote (include)));
- if (static_link) {
- compilerArgs.Add("/MT");
- monoFile = monoPath + @"\lib\mono-2.0.lib";
- }
- else {
- compilerArgs.Add("/MD");
- monoFile = monoPath + @"\lib\mono-2.0.dll";
- }
+ if (static_link)
+ monoFile = LocateFile (monoPath + @"\lib\monosgen-2.0.lib");
+ else
+ monoFile = LocateFile (monoPath + @"\lib\monosgen-2.0.dll");
+ compilerArgs.Add("/MD");
compilerArgs.Add(temp_c);
compilerArgs.Add(temp_o);
compilerArgs.Add("/link");
+ if (nomain)
+ compilerArgs.Add("/NOENTRY");
+ compilerArgs.Add("/DLL");
+
foreach (string lib in libs)
compilerArgs.Add(String.Format ("/LIBPATH:{0}", quote(lib)));
compilerArgs.Add (quote(monoFile));
}
assemblies.Add (a.CodeBase);
- } catch (Exception e) {
+ } catch (Exception) {
if (skip_scan) {
Console.WriteLine ("File will not be scanned: {0}", name);
assemblies.Add (new Uri (new FileInfo (name).FullName).ToString ());
if (!QueueAssembly (files, a.CodeBase))
return false;
}
- } catch (Exception e) {
+ } catch (Exception) {
if (!skip_scan)
throw;
}
}
return val;
}
+
+ static string LocateFile(string default_path)
+ {
+ var override_path = Path.Combine(Directory.GetCurrentDirectory(), Path.GetFileName(default_path));
+ if (File.Exists(override_path))
+ return override_path;
+ else if (File.Exists(default_path))
+ return default_path;
+ else
+ throw new FileNotFoundException(default_path);
+ }
}