Fixed first byte of data blocks being cut off
This commit is contained in:
+1
-1
@@ -175,12 +175,12 @@ func (d *dataReader) Read(p []byte) (int, error) {
|
|||||||
d.curReadOffset = 0
|
d.curReadOffset = 0
|
||||||
}
|
}
|
||||||
for ; read < len(p); read++ {
|
for ; read < len(p); read++ {
|
||||||
d.curReadOffset++
|
|
||||||
if d.curReadOffset < len(d.curData) {
|
if d.curReadOffset < len(d.curData) {
|
||||||
p[read] = d.curData[d.curReadOffset]
|
p[read] = d.curData[d.curReadOffset]
|
||||||
} else {
|
} else {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
d.curReadOffset++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if read != len(p) {
|
if read != len(p) {
|
||||||
|
|||||||
+15
-5
@@ -1,6 +1,7 @@
|
|||||||
package squashfs
|
package squashfs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@@ -12,10 +13,9 @@ import (
|
|||||||
const (
|
const (
|
||||||
downloadURL = "https://github.com/Swordfish90/cool-retro-term/releases/download/1.1.1/Cool-Retro-Term-1.1.1-x86_64.AppImage"
|
downloadURL = "https://github.com/Swordfish90/cool-retro-term/releases/download/1.1.1/Cool-Retro-Term-1.1.1-x86_64.AppImage"
|
||||||
appImageName = "Cool-Retro-Term.AppImage"
|
appImageName = "Cool-Retro-Term.AppImage"
|
||||||
squashfsName = "airootfs.sfs" //testing with a ArchLinux root fs from the live img
|
squashfsName = "balenaEtcher-1.5.113-x64.AppImage.sfs" //testing with a ArchLinux root fs from the live img
|
||||||
)
|
)
|
||||||
|
|
||||||
//Right now, don't use. Arch linux sfs uses XZ compression with filters, which isn't supported
|
|
||||||
func TestSquashfs(t *testing.T) {
|
func TestSquashfs(t *testing.T) {
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -29,10 +29,20 @@ func TestSquashfs(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
os.RemoveAll(wd + "/testing/" + squashfsName + ".d")
|
fmt.Println("stuff", rdr.super.CompressionType)
|
||||||
root, _ := rdr.GetRootFolder()
|
fil := rdr.GetFileAtPath("*.desktop")
|
||||||
errs := root.ExtractWithOptions(wd+"/testing/"+squashfsName+".d", false, false, os.ModePerm, true)
|
if fil == nil {
|
||||||
|
t.Fatal("Can't find desktop fil")
|
||||||
|
}
|
||||||
|
errs := fil.ExtractTo(wd + "/testing")
|
||||||
|
if len(errs) > 0 {
|
||||||
t.Fatal(errs)
|
t.Fatal(errs)
|
||||||
|
}
|
||||||
|
errs = rdr.ExtractTo(wd + "/testing/" + squashfsName + ".d")
|
||||||
|
if len(errs) > 0 {
|
||||||
|
t.Fatal(errs)
|
||||||
|
}
|
||||||
|
t.Fatal("No Problems")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAppImage(t *testing.T) {
|
func TestAppImage(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user