From: ttp Date: Tue, 2 Mar 2010 16:14:48 +0000 (+0900) Subject: AppliStation-GUI,書き込み禁止ファイルにエクスポートしようとすると異常終了する不具合を修正(エラーケースの処理追加) X-Git-Tag: v1.3.4~7^2~3 X-Git-Url: http://git.sourceforge.jp/view?p=applistation%2FAppliStation.git;a=commitdiff_plain;h=1062ab2882ead16571d3a113f0d4cf7bc43703ef AppliStation-GUI,書き込み禁止ファイルにエクスポートしようとすると異常終了する不具合を修正(エラーケースの処理追加) --- diff --git a/AppliStation/PackageListViewForm.cs b/AppliStation/PackageListViewForm.cs index 6ee1e35..b72d9f8 100644 --- a/AppliStation/PackageListViewForm.cs +++ b/AppliStation/PackageListViewForm.cs @@ -320,6 +320,7 @@ namespace AppliStation fd.Filter = "ソフトコレクションファイル (*.txt)|*.txt"; fd.DefaultExt = "txt"; fd.CheckPathExists = true; + fd.OverwritePrompt = true; fd.ShowDialog(); if (fd.FileNames.Length > 0) { string filepath = Path.GetFullPath(fd.FileName); @@ -331,6 +332,13 @@ namespace AppliStation try { collectionData.saveAs(fd.FileName); + } catch (UnauthorizedAccessException) { + if ((File.GetAttributes(fd.FileName) & FileAttributes.ReadOnly) != 0) { + MessageBox.Show("読み取り専用属性が設定されています。\n別のファイルを指定してください。", "エクスポート", MessageBoxButtons.OK, MessageBoxIcon.Error); + } else { + MessageBox.Show("ファイルへの書き込みが許可されていません。\n別のファイルを指定してください。", "エクスポート", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + return; } catch (IOException) { MessageBox.Show("ファイルの書き込みに失敗しました", "エクスポート", MessageBoxButtons.OK, MessageBoxIcon.Error); return;