diff options
author | Lluis Sanchez Gual <lluis@novell.com> | 2010-10-27 15:03:34 +0400 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@novell.com> | 2010-10-27 15:08:31 +0400 |
commit | 47db7e18dee185fc26bbbb64b60068fe9029ef85 (patch) | |
tree | c44fb5e3553958c699e26d6b611224915e9ca4de /main/src/addins/Deployment | |
parent | 456f48c0f19a3607b2d444d8b8875cdcebc53e4c (diff) |
Fix tarball generation issues on Windows
Tarball entries must use slashes, not backslashes.
Set some sane default file mode for files.
Diffstat (limited to 'main/src/addins/Deployment')
-rw-r--r-- | main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs index fdb56cb430..6f07a3555c 100644 --- a/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs +++ b/main/src/addins/Deployment/MonoDevelop.Deployment/MonoDevelop.Deployment/DeployService.cs @@ -45,7 +45,9 @@ using ICSharpCode.SharpZipLib.BZip2; using ICSharpCode.SharpZipLib.Zip.Compression.Streams; using ICSharpCode.SharpZipLib.Tar; using ICSharpCode.SharpZipLib.Zip; -using System.Reflection; +using System.Reflection;
+using Mono.Unix.Native;
+using Mono.Unix; namespace MonoDevelop.Deployment { @@ -137,10 +139,17 @@ namespace MonoDevelop.Deployment foreach (FilePath f in GetFilesRec (new DirectoryInfo (folder))) { TarEntry entry = TarEntry.CreateEntryFromFile (f); - entry.Name = f.ToRelative (folder); - if (!PropertyService.IsWindows) { - Mono.Unix.UnixFileInfo fi = new Mono.Unix.UnixFileInfo (f); - entry.TarHeader.Mode = (int) fi.Protection; + entry.Name = f.ToRelative (folder);
+ if (!PropertyService.IsWindows) {
+ UnixFileInfo fi = new UnixFileInfo (f);
+ entry.TarHeader.Mode = (int)fi.Protection;
+ }
+ else {
+ entry.Name = entry.Name.Replace ('\\', '/');
+ FilePermissions p = FilePermissions.S_IFREG | FilePermissions.S_IROTH | FilePermissions.S_IRGRP | FilePermissions.S_IRUSR;
+ if (!new FileInfo (f).IsReadOnly)
+ p |= FilePermissions.S_IWUSR;
+ entry.TarHeader.Mode = (int) p;
} archive.WriteEntry(entry, false); } @@ -158,11 +167,13 @@ namespace MonoDevelop.Deployment case ".zip": ZipOutputStream zs = new ZipOutputStream (outStream); zs.SetLevel(5); - FilePath baseDir = folder; byte[] buffer = new byte [8092]; - foreach (FilePath f in GetFilesRec (new DirectoryInfo (folder))) { - ZipEntry infoEntry = new ZipEntry (f.ToRelative (baseDir)); + foreach (FilePath f in GetFilesRec (new DirectoryInfo (folder))) {
+ string name = f.ToRelative (folder);
+ if (PropertyService.IsWindows)
+ name = name.Replace ('\\', '/'); + ZipEntry infoEntry = new ZipEntry (name);
zs.PutNextEntry (infoEntry); using (Stream s = File.OpenRead (f)) { int nr; |