tommyblue / smugmug-backup

Makes a full backup of a SmugMug account

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There does not seem to be any way to parse a valid destination path under Windows

philip-harvey opened this issue · comments

Bit of a noob here, sorry.

TOML seems to have an issue with Windows paths, and the usual work around of using single quotes instead of double quotes doesn't work in this app.
e.g. if I have:

[store]
destination = "C:\smugmug"

Then I get error
invalid escape sequence: \s

If I change that to
destination = 'c:\smugmug'

I get
error="Can't find in the destination folder C:\smugmug\: Destination path must be an absolute path"
The path C:\smugmug does exist.

I've also tested with adding a \ to the end of the path

TOML parser here says the single quote method should be valid, but seems to be not working.
https://toml-parser.com/

Actually, I don't have any windows machine. I'll try with a VM and see what's the problem

Stale issue message

I am also having problems with this. I have tried various combinations but nothing works:

c:\temp\sm_backup
c:\temp\sm_backup
c:\temp\sm_backup\
c:/temp/sm_backup
c:/temp/sm_backup/
C:/temp/sm_backup/

Some of the errors:

time="2020-11-26T10:32:48Z" level=fatal msg="Can't initialize the package" error="Can't find in the destination folder c:\\temp\\sm_backup\\: Destination path must be an absolute path"
time="2020-11-26T10:39:44Z" level=fatal msg="Can't initialize the package" error="Can't find in the destination folder C:\\temp\\sm_backup\\: Destination path must be an absolute path"
time="2020-11-26T10:44:46Z" level=fatal msg="Can't initialize the package" error="Can't find in the destination folder C:\\temp\\sm_backup: Destination path must be an absolute path"
time="2020-11-26T10:33:03Z" level=fatal msg="Can't initialize the package" error="Can't find in the destination folder c:/temp/sm_backup/: Destination path must be an absolute path"
time="2020-11-26T10:34:59Z" level=fatal msg="Can't initialize the package" error="Can't find in the destination folder C:/temp/sm_backup/: Destination path must be an absolute path"
time="2020-11-26T10:35:12Z" level=fatal msg="Can't initialize the package" error="Can't find in the destination folder C:/temp/sm_backup: Destination path must be an absolute path"

I've also tried single quotes but I cannot get that to work either.

Ok, I'm going to install Windows somewhere and test it

I think this is of interest: https://golang.org/src/path/path.go

This package does not deal with Windows paths with drive letters or backslashes;

https://golang.org/src/path/path.go#L203

// IsAbs reports whether the path is absolute.

func IsAbs(path string) bool {
	return len(path) > 0 && path[0] == '/'
}

Which will never work with Windows

Yup, but I found that path/filepath does the job. Just verified with windows and it works

As a temporary workaround it does seem to work if I put /temp/sm_backup as my destination to save to c:\temp\sm_backup

@jgough fixed in master. I'll release a new version asap