gehaxelt / ds_store Goto Github PK
View Code? Open in Web Editor NEWGO - Minimal parser for .DS_Store files
License: MIT License
GO - Minimal parser for .DS_Store files
License: MIT License
Your sample tool expects the filename to be passed with -i.
I think this could be made simpler by just accepting a filename, e.g.
ds_storeviewer [path_to]/.DS_Store
Also in case no parameter is given at all you could just try if .DS_Store exists in the current directory with its original filename and parse that.
Furthermore I'd suggest to have the example code as a file itself and not as part of the readme.
Hi, I'm having errors parsing a DS_Store
I'm using your code:
package main
import (
"fmt"
"os"
"flag"
"github.com/gehaxelt/ds_store"
"io/ioutil"
)
func main() {
var fileName string
flag.StringVar(&fileName, "i", "", "DS_Store input file")
flag.Parse()
if fileName == "" {
panic("FileName (-i): Must be specified")
} else if _, err := os.Stat(fileName); os.IsNotExist(err) {
panic("FileName (-i): File does not exist:" + fileName)
}
dat, err := ioutil.ReadFile(fileName)
if err != nil {
panic(err)
}
a, err := ds_store.NewAllocator(dat)
filenames, err := a.TraverseFromRootNode()
if err != nil {
panic(err)
}
for _,f := range filenames {
fmt.Printf("File: %s \n", f)
}
}
I've compiled it:
go build ds.go
After executing:
[/tmp]> ./ds -i DS_Store
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x10a3b76]
goroutine 1 [running]:
github.com/gehaxelt/ds_store.(*Allocator).TraverseFromRootNode(0x0, 0x1803, 0x1a03, 0x0, 0x10f0f60, 0xc00004e240)
/Users/jbono/go/src/github.com/gehaxelt/ds_store/ds_store.go:188 +0x26
main.main()
/tmp/ds.go:32 +0x13a
It's crashing in this function
Attached the DS_Store file as DS_Store.zip since GitHub doesn't allows DS_Store to be uploaded.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.