8000 Add file.DirectoryHash, file.FileHash and file.MoveDirectory by ZNixian · Pull Request #87 · blt4linux/blt4l · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

Merged
merged 4 commits into from
Sep 16, 2017

Conversation

ZNixian
Copy link
Member
@ZNixian ZNixian commented Sep 16, 2017

The accuracy of these functions has been tested using sha256sum and reading the source code of the windows version, so all results should match.

@RomanHargrave RomanHargrave self-requested a review September 16, 2017 02:06
@RomanHargrave RomanHargrave added the lua-api Relating to the lua API exposed by BLT label Sep 16, 2017
@ZNixian
Copy link
Member Author
ZNixian commented Sep 16, 2017

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;
Copy link
Member

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

Copy link
Member Author

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

@RomanHargrave
Copy link
Member

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>
Copy link
Member
@RomanHargrave RomanHargrave 10000 Sep 16, 2017

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.

Copy link
Member Author

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.

Copy link
Member

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) {
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just like if/else

@RomanHargrave
Copy link
Member

@ZNixian lmk when you are ready for a merge

@ZNixian ZNixian merged commit d1bae47 into blt4linux:master Sep 16, 2017
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) {
Copy link
Member

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.

@ZNixian ZNixian deleted the filemovehash branch September 16, 2017 02:22
@RomanHargrave RomanHargrave added this to the 2.0 milestone Sep 16, 2017
RomanHargrave added a commit that referenced this pull request Sep 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lua-api Relating to the lua API exposed by BLT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0