Skip to content

Commit

Permalink
Remove some uses of Assembly.Location and other methods that just don…
Browse files Browse the repository at this point in the history
…'t work when this library is used in a self-contained application
  • Loading branch information
baronfel authored and TheAngryByrd committed Apr 1, 2024
1 parent 2a44d6b commit 6fe2b3b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 65 deletions.
6 changes: 0 additions & 6 deletions src/Ionide.ProjInfo.ProjectSystem/Environment.fs
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ module Environment =
</> "fsc.exe"
)

let fsharpCore =
let dir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)

dir
</> "FSharp.Core.dll"

let workspaceLoadDelay () =
match System.Environment.GetEnvironmentVariable("FSAC_WORKSPACELOAD_DELAY") with
| delayMs when not (String.IsNullOrWhiteSpace(delayMs)) ->
Expand Down
7 changes: 1 addition & 6 deletions src/Ionide.ProjInfo.Sln/FileUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Ionide.ProjInfo.Sln.Shared

internal static class FileUtilitiesRegex
{
// regular expression used to match file-specs beginning with "<drive letter>:"
// regular expression used to match file-specs beginning with "<drive letter>:"
internal static readonly Regex DrivePattern = new Regex(@"^[A-Za-z]:");

// regular expression used to match UNC paths beginning with "\\<server>\<share>"
Expand Down Expand Up @@ -651,11 +651,6 @@ internal static bool HasExtension(string fileName, string[] allowedExtensions)
// ISO 8601 Universal time with sortable format
internal const string FileTimeFormat = "yyyy'-'MM'-'dd HH':'mm':'ss'.'fffffff";

/// <summary>
/// Get the currently executing assembly path
/// </summary>
internal static string ExecutingAssemblyPath => Path.GetFullPath(Assembly.GetAssembly(typeof(FileUtilities)).Location);

/// <summary>
/// Determines the full path for the given file-spec.
/// ASSUMES INPUT IS STILL ESCAPED
Expand Down
54 changes: 1 addition & 53 deletions src/Ionide.ProjInfo.Sln/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -764,58 +764,6 @@ internal static bool OSUsesCaseSensitivePaths
get { return IsLinux; }
}

/// <summary>
/// The base directory for all framework paths in Mono
/// </summary>
private static string s_frameworkBasePath;

/// <summary>
/// The directory of the current framework
/// </summary>
private static string s_frameworkCurrentPath;

/// <summary>
/// Gets the currently running framework path
/// </summary>
internal static string FrameworkCurrentPath
{
get
{
if (s_frameworkCurrentPath == null)
{
var baseTypeLocation = Assembly.GetAssembly(typeof(string)).Location;

s_frameworkCurrentPath =
Path.GetDirectoryName(baseTypeLocation)
?? string.Empty;
}

return s_frameworkCurrentPath;
}
}

/// <summary>
/// Gets the base directory of all Mono frameworks
/// </summary>
internal static string FrameworkBasePath
{
get
{
if (s_frameworkBasePath == null)
{
var dir = FrameworkCurrentPath;
if (dir != string.Empty)
{
dir = Path.GetDirectoryName(dir);
}

s_frameworkBasePath = dir ?? string.Empty;
}

return s_frameworkBasePath;
}
}

/// <summary>
/// System information, initialized when required.
/// </summary>
Expand Down Expand Up @@ -1674,4 +1622,4 @@ internal static bool FileOrDirectoryExistsWindows(string path)
#endregion

}
}
}

0 comments on commit 6fe2b3b

Please sign in to comment.