Skip to content

Commit

Permalink
fix: fix special char export and add ext on windos compilation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelesaux committed Oct 26, 2021
1 parent 904e4e5 commit b5ada60
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
rawexport = flag.Bool("rawexport", false, "raw exports the amsdosfile, this option is associated with -dsk, -track and -sector.\nThis option will do a raw extract of the content beginning to track and sector values and will stop when size is reached.\nfor instance : dsk -dsk mydskfile.dsk -amsdosfile file.bin -rawexport -track 1 -sector 0 -size 16384")
size = flag.Int("size", 0, "Size to extract in rawexport, see rawexport for more details.")
autotest = flag.Bool("autotest", false, "Executs all tests.")
version = "0.14"
version = "0.15"
)

func main() {
Expand Down Expand Up @@ -649,7 +649,10 @@ func getFileDsk(d dsk.DSK) (onError bool, message, hint string) {
var lastFilename string
for indice, v := range d.Catalogue {
if v.User != dsk.USER_DELETED && v.NbPages != 0 {
filename := fmt.Sprintf("%s.%s", v.Nom, v.Ext)
var nom, ext string
nom = dsk.ToAscii(v.Nom[:])
ext = dsk.ToAscii(v.Ext[:])
filename := fmt.Sprintf("%s.%s", nom, ext)
if lastFilename == filename {
continue
}
Expand Down
8 changes: 4 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ build:
@echo "Compilation for linux amd64"
(make compile ARCH=amd64 OS=linux)
@echo "Compilation for windows amd64"
(make compile ARCH=amd64 OS=windows)
(make compile ARCH=amd64 OS=windows EXT=.exe)
@echo "Compilation for macos"
(make compile ARCH=amd64 OS=darwin)
@echo "Compilation for raspberry pi Raspbian 64bits"
(make compile ARCH=arm64 OS=linux)
@echo "Compilation for raspberry pi Raspbian 32bits"
(make compile ARCH=arm OS=linux GOARM=5)
@echo "Compilation for older windows"
(make compile ARCH=386 OS=windows)
(make compile ARCH=386 OS=windows EXT=.exe)

clean:
@echo "Cleaning project"
rm -f dsk-*

compile:
GOOS=${OS} GOARCH=${ARCH} go build ${LDFLAGS} -o dsk-${OS}-${ARCH} $(SOURCEDIR)/main.go
zip dsk-$(appversion)-${OS}-${ARCH}.zip dsk-${OS}-${ARCH}
GOOS=${OS} GOARCH=${ARCH} go build ${LDFLAGS} -o dsk-${OS}-${ARCH}${EXT} $(SOURCEDIR)/main.go
zip dsk-$(appversion)-${OS}-${ARCH}.zip dsk-${OS}-${ARCH}${EXT}
9 changes: 9 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,12 @@ func DisplayHex(b []byte, width int) string {
}
return out
}

func ToAscii(b []byte) string {
var out string
for _, v := range b {
v &= 127
out += string(v)
}
return out
}

0 comments on commit b5ada60

Please sign in to comment.