Skip to content

made lib windows compatible - #4

Open
KoKoKotlin wants to merge 1 commit into
JayTee42:masterfrom
KoKoKotlin:master
Open

made lib windows compatible#4
KoKoKotlin wants to merge 1 commit into
JayTee42:masterfrom
KoKoKotlin:master

Conversation

@KoKoKotlin

Copy link
Copy Markdown

No description provided.

@JayTee42 JayTee42 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

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

@KoKoKotlin

Copy link
Copy Markdown
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants