Don't crash if stable doesn't exist

This commit is contained in:
Jiiks 2018-01-10 17:50:26 +02:00
parent 2a29984950
commit 8688a9ea7d
3 changed files with 8 additions and 3 deletions

3
.gitignore vendored
View File

@ -16,3 +16,6 @@ Installers/dotNet/dlls/
v2/dist/vendor/ v2/dist/vendor/
v2/lib/static.js v2/lib/static.js
**/*.suo **/*.suo
Installers/**/*/bin
Installers/**/*/obj
Installers/**/*/packages

View File

@ -42,14 +42,14 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="asardotnetasync"> <Reference Include="asardotnetasync">
<HintPath>..\..\..\..\..\..\Projects\C#\asardotnetasync\asardotnetasync\bin\Release\asardotnetasync.dll</HintPath> <HintPath>..\..\..\..\..\Projects\C#\asardotnetasync\asardotnetasync\bin\Release\asardotnetasync.dll</HintPath>
</Reference> </Reference>
<Reference Include="Costura, Version=1.6.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL"> <Reference Include="Costura, Version=1.6.2.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll</HintPath> <HintPath>..\packages\Costura.Fody.1.6.2\lib\dotnet\Costura.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\..\..\libs\Newtonsoft.Json.dll</HintPath> <HintPath>..\..\..\..\..\libs\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />

View File

@ -73,6 +73,7 @@ namespace BetterDiscordWI.panels {
private void LocateDiscord() { private void LocateDiscord() {
var finalPath = GetLatestVersion(cbPtb.Checked ? PtbPath : cbCanary.Checked ? CanaryPath : StablePath); var finalPath = GetLatestVersion(cbPtb.Checked ? PtbPath : cbCanary.Checked ? CanaryPath : StablePath);
if (finalPath == string.Empty) finalPath = "Not found!";
tbPath.Text = finalPath; tbPath.Text = finalPath;
_formMain.DiscordPath = finalPath; _formMain.DiscordPath = finalPath;
@ -85,6 +86,7 @@ namespace BetterDiscordWI.panels {
private string GetLatestVersion(string path) { private string GetLatestVersion(string path) {
var dirs = Directory.GetDirectories(path); var dirs = Directory.GetDirectories(path);
if (dirs.Length <= 0) return string.Empty;
var latest = dirs[0]; var latest = dirs[0];
foreach (var dir in dirs) { foreach (var dir in dirs) {