-
Notifications
You must be signed in to change notification settings - Fork 14
Add file.DirectoryHash, file.FileHash and file.MoveDirectory #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reference: See issue #85 |
src/lapi.cc
Outdated
if(strlen(to) != toLen) | ||
luaL_error(state, "file.MoveDirectory(from, to): argument 'to' cannot contain null characters!"); | ||
|
||
bool result = rename(from, to) == 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would prefer (rename() == 0)
fwiw.
lgtm tho
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do that quickly
Have not compared side/side with BLT4W but everything looks good WRT style, with a few minor notes, primarily that I like newlines before any bracket, but I don't really care all that much. |
#include <stack> | ||
#include <algorithm> | ||
|
||
#include <openssl/sha.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i suppose this resolves the long-time issue of OpenSSL vs GNUTLS WRT cURL deps on certain distros.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, I'd use IFDEF to use either, but I've never used GNUTLS before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally don't care. There's always the option of implementing sha256 🎉.
But, you know, that's not really worthwhile.
src/lapi.cc
Outdated
|
||
bool result = (rename(from, to) == 0); | ||
lua_pushboolean(state, result); | ||
if(!result) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my PR comment about brackets
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I realized near the start that they should go on a seperate line, and changed them, but I must have missed a few. I'll fix that now too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you format catch(...) blocks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just like if/else
@ZNixian lmk when you are ready for a merge |
src/lapi.cc
Outdated
@@ -174,7 +177,8 @@ namespace blt { | |||
|
|||
lua_pushlstring(state, hash.c_str(), hash.length()); | |||
return 1; | |||
} catch(string e) { | |||
} | |||
catch(string e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a hanging bracket there.
The accuracy of these functions has been tested using sha256sum and reading the source code of the windows version, so all results should match.