OSDN Git Service

na-get-lib,ダウンロードしたインストーラファイルの権限を落とす暫定コードを追加。
[applistation/AppliStation.git] / na-get-lib / NaGet.Packages.Install / Installation.cs
index f8ab19d..fd0523a 100644 (file)
@@ -187,6 +187,12 @@ namespace NaGet.Packages.Install
                                        File.Move(installerFile, newFile);\r
                                        installerFile = newFile;\r
                                }\r
+                               \r
+                               // 権限を親フォルダに落とす\r
+                               try {\r
+                                       string targetDir = Path.GetDirectoryName(installerFile);\r
+                                       NaGet.Utils.SetAccessControlRecursive(targetDir, File.GetAccessControl(Path.GetDirectoryName(targetDir)));\r
+                               } catch (Exception) {} // 失敗時は何もしない\r
                        }\r
                }\r
                \r
@@ -356,7 +362,7 @@ namespace NaGet.Packages.Install
                }\r
                \r
                /// <summary>\r
-               /// ã\82¤ã\83³ã\82¹ã\83\88ã\83¼ã\83©ã\81®ä¸\80æ\99\82ä¿\9då­\98å\85\88ã\83\91ã\82¹ã\82\92ç\94\9fæ\88\90\r
+               /// インストーラの保存先パスを生成\r
                /// </summary>\r
                private string getArchiveFilePath()\r
                {\r
@@ -374,6 +380,11 @@ namespace NaGet.Packages.Install
                                        }\r
                                } else {\r
                                        Directory.CreateDirectory(folder);\r
+                                       \r
+                                       // 権限を親フォルダに合わせる\r
+                                       try {\r
+                                               Directory.SetAccessControl(folder, Directory.GetAccessControl(Path.GetDirectoryName(folder)));\r
+                                       } catch (Exception) {} // 失敗時無視\r
                                }\r
                        }\r
                        \r
@@ -462,6 +473,8 @@ namespace NaGet.Packages.Install
                                                               new FileNotFoundException(errMsg, archiveInstExe));\r
                        }\r
                        \r
+                       \r
+                       \r
                        ProcessStartInfo procInfo = new ProcessStartInfo(archiveInstExe, archiveInstArgs);\r
                        procInfo.UseShellExecute = false;\r
                        procInfo.CreateNoWindow = true;\r