Skip to content

Commit

Permalink
Merge branch 'master' of github.com:SpartanJ/efsw
Browse files Browse the repository at this point in the history
  • Loading branch information
SpartanJ committed Nov 9, 2024
2 parents a3ca44b + 8d46d1c commit 1d12b47
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y wget
wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha14/premake-5.0.0-alpha14-linux.tar.gz
tar xvzf premake-5.0.0-alpha14-linux.tar.gz
wget https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz
tar xvzf premake-5.0.0-beta2-linux.tar.gz
- name: Build
run: |
./premake5 --verbose gmake2
Expand All @@ -24,28 +24,26 @@ jobs:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
brew install wget
wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha14/premake-5.0.0-alpha14-macosx.tar.gz
tar -xzf premake-5.0.0-alpha14-macosx.tar.gz
brew install premake
- name: Build
run: |
./premake5 --verbose gmake2
make -C make/macosx/ -j`nproc` all
premake5 --verbose gmake2
make -C make/macosx/ -j$(sysctl -n hw.ncpu) all
Windows:
runs-on: windows-2019
runs-on: windows-latest
env:
MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\
MSBUILD_PATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\
steps:
- uses: actions/checkout@v2
- name: Install dependencies
shell: powershell
run: |
Invoke-WebRequest -Uri "https://github.com/premake/premake-core/releases/download/v5.0.0-alpha14/premake-5.0.0-alpha14-windows.zip" -OutFile "premake-5.0.0-alpha14-windows.zip"
Expand-Archive -DestinationPath . -Path premake-5.0.0-alpha14-windows.zip
Invoke-WebRequest -Uri "https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip" -OutFile "premake-5.0.0-beta2-windows.zip"
Expand-Archive -DestinationPath . -Path premake-5.0.0-beta2-windows.zip
- name: Create project
shell: powershell
run: |
./premake5.exe --verbose vs2019
./premake5.exe --verbose vs2022
- name: Build
shell: cmd
run: |
Expand Down
6 changes: 3 additions & 3 deletions src/efsw/FileWatcherCWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class Watcher_CAPI : public efsw::FileWatchListener {
*/
static std::vector<Watcher_CAPI*> g_callbacks;

Watcher_CAPI* find_callback( efsw_watcher watcher, efsw_pfn_fileaction_callback fn ) {
Watcher_CAPI* find_callback( efsw_watcher watcher, efsw_pfn_fileaction_callback fn, void* param ) {
for ( std::vector<Watcher_CAPI*>::iterator i = g_callbacks.begin(); i != g_callbacks.end();
++i ) {
Watcher_CAPI* callback = *i;

if ( callback->mFn == fn && callback->mWatcher == watcher )
if ( callback->mFn == fn && callback->mWatcher == watcher && callback->mParam == param )
return *i;
}

Expand Down Expand Up @@ -84,7 +84,7 @@ efsw_watchid efsw_addwatch_withoptions(efsw_watcher watcher, const char* direct
efsw_pfn_fileaction_callback callback_fn, int recursive,
efsw_watcher_option *options, int options_number,
void* param) {
Watcher_CAPI* callback = find_callback( watcher, callback_fn );
Watcher_CAPI* callback = find_callback( watcher, callback_fn, param );

if ( callback == NULL ) {
callback = new Watcher_CAPI( watcher, callback_fn, param );
Expand Down
11 changes: 7 additions & 4 deletions src/efsw/FileWatcherFSEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ void FileWatcherFSEvents::FSEventCallback( ConstFSEventStreamRef streamRef, void
CFDictionaryGetValue( pathInfoDict, kFSEventStreamEventExtendedDataPathKey ) );
CFNumberRef cfInode = static_cast<CFNumberRef>(
CFDictionaryGetValue( pathInfoDict, kFSEventStreamEventExtendedFileIDKey ) );
unsigned long inode = 0;
CFNumberGetValue( cfInode, kCFNumberLongType, &inode );
events.push_back( FSEvent( convertCFStringToStdString( path ), (long)eventFlags[i],
(Uint64)eventIds[i], inode ) );

if ( cfInode ) {
unsigned long inode = 0;
CFNumberGetValue( cfInode, kCFNumberLongType, &inode );
events.push_back( FSEvent( convertCFStringToStdString( path ), (long)eventFlags[i],
(Uint64)eventIds[i], inode ) );
}
} else {
events.push_back( FSEvent( std::string( ( (char**)eventPaths )[i] ),
(long)eventFlags[i], (Uint64)eventIds[i] ) );
Expand Down
3 changes: 1 addition & 2 deletions src/efsw/String.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <cstdlib>
#include <cstring>
#include <efsw/base.hpp>
#include <fstream>
#include <iostream>
#include <locale>
#include <sstream>
Expand All @@ -24,7 +23,7 @@ namespace efsw {
* **/
class String {
public:
typedef Uint32 StringBaseType;
typedef char32_t StringBaseType;
typedef std::basic_string<StringBaseType> StringType;
typedef StringType::iterator Iterator; //! Iterator type
typedef StringType::const_iterator ConstIterator; //! Constant iterator type
Expand Down
8 changes: 4 additions & 4 deletions src/efsw/WatcherWin32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void initReadDirectoryChangesEx() {
if ( !hModule )
return;

pReadDirectoryChangesExW =
pReadDirectoryChangesExW =
(EFSW_LPREADDIRECTORYCHANGESEXW)GetProcAddress( hModule, "ReadDirectoryChangesExW" );
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ void CALLBACK WatchCallback( DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOve
/// Refreshes the directory monitoring.
RefreshResult RefreshWatch( WatcherStructWin32* pWatch ) {
initReadDirectoryChangesEx();

bool bRet = false;
RefreshResult ret = RefreshResult::Failed;
pWatch->Watch->Extended = false;
Expand All @@ -198,7 +198,7 @@ RefreshResult RefreshWatch( WatcherStructWin32* pWatch ) {
pWatch->Watch->Extended = true;
}
}

if ( !bRet ) {
bRet = ReadDirectoryChangesW( pWatch->Watch->DirHandle, pWatch->Watch->Buffer.data(),
(DWORD)pWatch->Watch->Buffer.size(), pWatch->Watch->Recursive,
Expand Down Expand Up @@ -247,7 +247,7 @@ WatcherStructWin32* CreateWatch( LPCWSTR szDirectory, bool recursive,
pWatch->NotifyFilter = notifyFilter;
pWatch->Recursive = recursive;

if ( RefreshWatch( tWatch ) ) {
if ( RefreshResult::Failed != RefreshWatch( tWatch ) ) {
return tWatch;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/efsw/WatcherWin32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace efsw {

class WatcherWin32;

enum RefreshResult { Success, SucessEx, Failed };
enum RefreshResult { Failed, Success, SucessEx };

/// Internal watch data
struct WatcherStructWin32 {
Expand Down

0 comments on commit 1d12b47

Please sign in to comment.