made lib windows compatible - #4
Open
KoKoKotlin wants to merge 1 commit into
Open
Conversation
JayTee42
reviewed
Jan 9, 2022
JayTee42
left a comment
Owner
There was a problem hiding this comment.
Hey :) generell gut, aber ist garantiert, dass R_OK / W_OK in POSIX immer als 0x02 / 0x04 definiert sind? Und hier steht, dass man unter Windows _access() nehmen sollte. Wie wäre es mit sowas hier?
#ifdef _WIN32
#include <io.h>
int isFileAccessible(const char* filePath)
{
return _access(filePath, 6) == 0;
}
#else
#include <unistd.h>
int isFileAccessible(const char* filePath)
{
return access(filePath, R_OK | W_OK) == 0;
}
#endif
Author
|
Jo denke mal, dass das so besser ist. Die Sache ist bloß, dass ich mir mit der Macro _WIN32 nicht sicher bin, ob die geht. Ich hatte das mit der auch probiert, aber irgendwie ging das mit dem MC Compiler nicht |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.