Use absolute folder path

This commit is contained in:
Jaex 2018-02-08 10:03:28 +03:00
parent bf8a826f77
commit 98d2ad63eb
2 changed files with 13 additions and 4 deletions

View file

@ -133,6 +133,7 @@ private void InitializeComponent()
this.tsbEditStickers.ImageTransparentColor = System.Drawing.Color.Magenta; this.tsbEditStickers.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbEditStickers.Name = "tsbEditStickers"; this.tsbEditStickers.Name = "tsbEditStickers";
this.tsbEditStickers.Size = new System.Drawing.Size(23, 23); this.tsbEditStickers.Size = new System.Drawing.Size(23, 23);
this.tsbEditStickers.Text = "Edit sticker packs";
this.tsbEditStickers.Click += new System.EventHandler(this.tsbEditStickers_Click); this.tsbEditStickers.Click += new System.EventHandler(this.tsbEditStickers_Click);
// //
// tslSize // tslSize

View file

@ -88,13 +88,21 @@ private void UpdateStickerPacks()
private void LoadImageFiles() private void LoadImageFiles()
{ {
imageFiles = null;
ilvStickers.Items.Clear();
StickerPackInfo stickerPack = tscbStickers.SelectedItem as StickerPackInfo; StickerPackInfo stickerPack = tscbStickers.SelectedItem as StickerPackInfo;
if (stickerPack != null && Directory.Exists(stickerPack.FolderPath)) if (stickerPack != null && !string.IsNullOrEmpty(stickerPack.FolderPath))
{ {
imageFiles = Directory.GetFiles(stickerPack.FolderPath).Where(x => Helpers.IsImageFile(x)).ToArray(); string folderPath = Helpers.GetAbsolutePath(stickerPack.FolderPath);
UpdateImageFiles(); if (Directory.Exists(folderPath))
{
imageFiles = Directory.GetFiles(folderPath).Where(x => Helpers.IsImageFile(x)).ToArray();
UpdateImageFiles();
}
} }
} }
@ -135,7 +143,7 @@ private void tstbSearch_TextChanged(object sender, EventArgs e)
{ {
UpdateImageFiles(); UpdateImageFiles();
if (ilvStickers.Items.Count > 0) if (ilvStickers.Items.Count > 0 && !string.IsNullOrEmpty(tstbSearch.Text))
{ {
ilvStickers.Items[0].Selected = true; ilvStickers.Items[0].Selected = true;
} }