cvs: pear /File_Archive/Archive/Writer Ar.php
| From: | Pablo Fischer | Date: | Mon, 23 May 2005 18:38:15 +0000 |
| Subject: | cvs: pear /File_Archive/Archive/Writer Ar.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-32075@lists.php.net to get a copy of this message | ||
pfischer Mon May 23 14:38:15 2005 EDT
Modified files:
/pear/File_Archive/Archive/Writer Ar.php
Log:
Hope this will work.
- Take care when to add the <arch> stuff
http://cvs.php.net/diff.php/pear/File_Archive/Archive/Writer/Ar.php?r1=1.3&r2=1.4&ty=u
Index: pear/File_Archive/Archive/Writer/Ar.php
diff -u pear/File_Archive/Archive/Writer/Ar.php:1.3 pear/File_Archive/Archive/Writer/Ar.php:1.4
--- pear/File_Archive/Archive/Writer/Ar.php:1.3 Mon May 23 14:24:52 2005
+++ pear/File_Archive/Archive/Writer/Ar.php Mon May 23 14:38:14 2005
@@ -70,7 +70,7 @@
if ($this->_currentFilename != null) {
$this->_currentStat[7] = strlen($this->_buffer);
$this->_currentStat['size'] = $this->_currentStat[7];
- $currentSize = $this->_currentStat[7];
+ $currentSize = $this->_currentStat[7];
if ($this->_useBuffer) {
//if file length is > than 16..
if (strlen($this->_currentFilename) > 16) {
@@ -101,7 +101,8 @@
if ($currentSize % 2 == 1) {
$this->innerWriter->writeData("\n");
}
- }
+ }
+
}
$this->_buffer = "";
}
@@ -113,8 +114,7 @@
function newFile($filename, $stat = array (),
$mime = "application/octet-stream")
{
- $this->flush();
-
+ $this->flush();
/**
* If the file is empty, there's no reason to have a buffer
* or use memory
@@ -129,7 +129,6 @@
*/
function close()
{
- $this->innerWriter->writeData("!<arch>\n");
$this->flush();
parent::close();
}
@@ -142,6 +141,10 @@
if ($this->_useBuffer) {
$this->_buffer .= $data;
} else {
+ if ($this->_currentStat[7] == 0 ||
+ strlen($this->_buffer) == 0) {
+ $this->innerWriter->writeData("!<arch>\n");
+ }
$this->innerWriter->writeData($data);
}
@@ -153,7 +156,7 @@
{
if ($this->_useBuffer) {
$this->_buffer .= file_get_contents($filename);
- } else {
+ } else {
$this->innerWriter->writeFile($filename);
}
}