Menci / hexo-deployer-upyun

UPYUN deployer for Hexo.
GNU General Public License v3.0
23 stars 6 forks source link

Upload Subdirectory as File #2

Open NoahDragon opened 7 years ago

NoahDragon commented 7 years ago

E.g. I have a file under public/blog/2015/10/12/index.html, it will be uploaded as following folders (Note: they are folders with that exact name, not folder path):

blog/2015 blog/2015/10 blog/2015/10/12

Menci commented 7 years ago

Can you provide a demo uploaded site?

Do you mean blog/2015, blog/2015/10 and blog/2015/10/12 are all files?

NoahDragon commented 7 years ago

Sorry, I didn't explain clearly. I have updated the original question.

Let's say blog/2015, it is a folder with the name of string "blog/2015", and under that folder is empty.

Menci commented 7 years ago

Well, we can't make a directory with a / in the name.

Menci@Menci-Laptop ~ node
> fs.mkdirSync('a\/b')
Error: ENOENT: no such file or directory, mkdir 'a/b'
    at Object.fs.mkdirSync (fs.js:854:18)
    at repl:1:4
    at realRunInThisContextScript (vm.js:22:35)
    at sigintHandlersWrap (vm.js:98:12)
    at ContextifyScript.Script.runInThisContext (vm.js:24:12)
    at REPLServer.defaultEval (repl.js:346:29)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.onLine (repl.js:545:10)
    at emitOne (events.js:101:20)
> 
NoahDragon commented 7 years ago

Sorry, my mistake again. It is "blog\2015".

I'm using win8.1 OS. I think it is caused by the different Unix/Win path system.

image

The folder is looks like the image above.

Menci commented 7 years ago

It seems a cross-platform issue. It works well under Linux and OS X.

I'll check the code, maybe I should use / under all platform for the path spliter.

Menci commented 7 years ago

I don't have Windows. I tried this https://github.com/Menci/hexo-deployer-upyun/commit/b8db95fe4f552695d8e6282d52ceacd356728ff0 in the branch https://github.com/Menci/hexo-deployer-upyun/tree/fix-win32-path. It may fix it.

NoahDragon commented 7 years ago

Thank you, I will try it, and keep you updated.