Created
December 15, 2015 05:18
-
-
Save ShaneGowland/4a13b4c8fde9ff8f6ab1 to your computer and use it in GitHub Desktop.
“Intermediary” executable file that can easily be set as the default associated program for filetypes that then passes the file along to Atom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Module Module1 | |
Sub Main() | |
'Get the directory path | |
Dim exe_path As String = (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\atom\") | |
'Variable for the highest version | |
Dim highest_version As New Version("0.0.1") | |
'Variable for the directory storing the highest version | |
Dim highest_ver_dir As String = "" | |
Try | |
'Iterate through the directory | |
For Each foundFolder As String In IO.Directory.GetDirectories(exe_path, "*") | |
'Look only for app directories | |
If foundFolder.Replace(exe_path, "").StartsWith("app-") Then | |
'Get the version string | |
Dim this_version As String = foundFolder.Replace(exe_path & "app-", "") | |
Dim new_version As New Version(this_version) | |
'Compare the version | |
If new_version.CompareTo(highest_version) > 0 Then | |
highest_version = new_version | |
highest_ver_dir = foundFolder | |
End If | |
End If | |
Next | |
Catch ex As Exception | |
Console.WriteLine(ex.Message) | |
End Try | |
'Get the filepath to the highest version exe | |
Dim atom_exe As String = highest_ver_dir & "\atom.exe" | |
Try | |
Process.Start(atom_exe, My.Application.CommandLineArgs(0)) | |
Catch ex As Exception | |
Console.Write(ex.Message) | |
End Try | |
End Sub | |
End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Here's a modification that would allow opening files which have names containing spaces
Credits to @Bloodb0ne.