Compare commits

...

3 Commits

17 changed files with 3837 additions and 3284 deletions

18
.clang-format Normal file
View File

@ -0,0 +1,18 @@
---
AlignEscapedNewlines: Left
AllowAllConstructorInitializersOnNextLine: 'true'
AllowAllParametersOfDeclarationOnNextLine: 'true'
AllowShortFunctionsOnASingleLine: Inline
BreakConstructorInitializers: AfterColon
ColumnLimit: '100'
CompactNamespaces: 'true'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
ContinuationIndentWidth: '4'
IndentCaseLabels: 'true'
IndentWidth: '4'
PointerAlignment: Left
SpacesInParentheses: 'true'
TabWidth: '4'
UseTab: Always
...

21
.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
bin/
build/
obj/
make/
lib/
CMakeFiles/
/cmake
/CMakeCache.txt
/cmake_install.cmake
/Makefile
*.DS_Store
.qtc_clangd
.cmake
.vscode/
*.so
*.a
*.dylib
*.lib
/.cache
/efsw-test
/efsw-test-stdc

View File

@ -1,57 +0,0 @@
# joomer-efsw-file-monitoring
Watch folder for images and flip them
# Demonstrates
- file monitoring
# Usage
```
joomer-ftxui-file-monitoring
- drag and drop files into the path folder
```
[todo]
# Build
```
learndir/
└── joomer-ftxui-file-monitoring/
```
- Download and Install Premake
## Ubuntu Linux (kasm-ubuntu)
```
mkdir learndir
cd learndir
git clone https://git.indoodle.com/jason/joomer-efsw-file-monitoring.git
cd joomer-ftxui-file-browser
make all
bin/Linux/release/joomer-ftxui-file-monitoring
```
## Windows (win10 enterprise)
- Download Visual Studio Community Edition 2022
- Run VisualStudioSetup.exe
- Workload = [x] Desktop developemnt with C++
- Individial components = [x] Git For Windows
Run **x64 Native Tools Command Prompt for VS 2022**
```
mkdir learndir
cd learndir
git clone https://git.indoodle.com/jason/joomer-ftxui-file-monitoring.git
cd joomer-ftxui-file-monitoring
msbuild joomer-ftxui-file-monitoring.vcxproj /t:Build /p:Configuration=Debug /p:Platform=x64
bin\Debug\joomer-ftxui-file-monitoring.exe
```
For a prototype app we can just dump the stb headers right into the helloworld dir for simplicity
```
curl -LO https://raw.githubusercontent.com/nothings/stb/master/stb_image.h
curl -LO https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h
make all -j4
```

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.2, 2019-11-10T01:12:11. -->
@ -209,3 +210,216 @@
<value type="int">22</value>
</data>
</qtcreator>
=======
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.2, 2019-11-10T01:12:11. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{55fc4913-4acc-49e6-b0d5-ebf25d4d498e}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{eb5b6178-a7a7-439e-ab01-e63b057196a1}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\programming\efsw\make\windows</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">false</value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand"></value>
<value type="bool" key="GenericProjectManager.GenericMakeStep.OverrideMakeflags">false</value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="GenericProjectManager.GenericMakeStep.Clean">true</value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeArguments"></value>
<value type="QString" key="GenericProjectManager.GenericMakeStep.MakeCommand"></value>
<value type="bool" key="GenericProjectManager.GenericMakeStep.OverrideMakeflags">false</value>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Default</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Default</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}\..\..\bin\efsw-test-debug.exe</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run C:\programming\efsw\bin\efsw-test-debug.exe</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>
>>>>>>> 0adf96dcdb6ba38e789d409ca1bf1fc149e60808

View File

@ -1,3 +1,4 @@
<<<<<<< HEAD
../../include/efsw/efsw.hpp
../../premake5.lua
../../src/efsw/FileWatcher.cpp
@ -213,3 +214,220 @@
../../src/efsw/Debug.cpp
../../include/efsw/efsw.h
../../src/efsw/FileWatcherCWrapper.cpp
=======
../../include/efsw/efsw.hpp
../../premake5.lua
../../src/efsw/FileWatcher.cpp
../../src/efsw/FileWatcherInotify.cpp
../../src/efsw/FileWatcherKqueue.cpp
../../src/efsw/FileWatcherWin32.cpp
../../src/efsw/FileWatcherWin32.hpp
../../src/efsw/FileWatcherKqueue.hpp
../../src/efsw/FileWatcherInotify.hpp
../../src/efsw/FileWatcherImpl.hpp
../../src/efsw/FileWatcherWin32.cpp
../../src/efsw/FileWatcherKqueue.cpp
../../src/efsw/FileWatcherInotify.cpp
../../src/efsw/FileWatcher.cpp
../../src/efsw/Thread.cpp
../../src/efsw/Mutex.cpp
../../src/efsw/System.cpp
../../src/efsw/platform/platformimpl.hpp
../../src/efsw/platform/posix/ThreadImpl.hpp
../../src/efsw/platform/posix/MutexImpl.hpp
../../src/efsw/platform/posix/SystemImpl.hpp
../../src/efsw/platform/posix/ThreadImpl.cpp
../../src/efsw/platform/posix/MutexImpl.cpp
../../src/efsw/platform/posix/SystemImpl.cpp
../../src/efsw/platform/win/ThreadImpl.hpp
../../src/efsw/platform/win/MutexImpl.hpp
../../src/efsw/platform/win/SystemImpl.hpp
../../src/efsw/platform/win/ThreadImpl.cpp
../../src/efsw/platform/win/MutexImpl.cpp
../../src/efsw/platform/win/SystemImpl.cpp
../../src/efsw/base.hpp
../../src/efsw/FileWatcherGeneric.hpp
../../src/efsw/FileWatcherGeneric.cpp
../../src/efsw/FileSystem.cpp
../../src/efsw/platform/posix/FileSystemImpl.hpp
../../src/efsw/platform/posix/FileSystemImpl.cpp
../../src/efsw/platform/win/FileSystemImpl.hpp
../../src/efsw/platform/win/FileSystemImpl.cpp
../../src/efsw/FileInfo.cpp
../../src/efsw/base.hpp
../../src/efsw/Thread.hpp
../../src/efsw/System.hpp
../../src/efsw/Mutex.hpp
../../src/efsw/FileWatcherWin32.hpp
../../src/efsw/FileWatcherKqueue.hpp
../../src/efsw/FileWatcherInotify.hpp
../../src/efsw/FileWatcherImpl.hpp
../../src/efsw/FileWatcherGeneric.hpp
../../src/efsw/FileSystem.hpp
../../src/efsw/FileInfo.hpp
../../src/efsw/Thread.cpp
../../src/efsw/System.cpp
../../src/efsw/Mutex.cpp
../../src/efsw/FileWatcherWin32.cpp
../../src/efsw/FileWatcherKqueue.cpp
../../src/efsw/FileWatcherInotify.cpp
../../src/efsw/FileWatcherGeneric.cpp
../../src/efsw/FileWatcher.cpp
../../src/efsw/FileSystem.cpp
../../src/efsw/FileInfo.cpp
../../src/efsw/sophist.h
../../src/efsw/base.hpp
../../src/efsw/Utf.hpp
../../src/efsw/Thread.hpp
../../src/efsw/System.hpp
../../src/efsw/String.hpp
../../src/efsw/Mutex.hpp
../../src/efsw/FileWatcherWin32.hpp
../../src/efsw/FileWatcherKqueue.hpp
../../src/efsw/FileWatcherInotify.hpp
../../src/efsw/FileWatcherImpl.hpp
../../src/efsw/FileWatcherGeneric.hpp
../../src/efsw/FileSystem.hpp
../../src/efsw/FileInfo.hpp
../../src/efsw/Utf.inl
../../src/efsw/Thread.cpp
../../src/efsw/System.cpp
../../src/efsw/String.cpp
../../src/efsw/Mutex.cpp
../../src/efsw/FileWatcherWin32.cpp
../../src/efsw/FileWatcherKqueue.cpp
../../src/efsw/FileWatcherInotify.cpp
../../src/efsw/FileWatcherGeneric.cpp
../../src/efsw/FileWatcher.cpp
../../src/efsw/FileSystem.cpp
../../src/efsw/FileInfo.cpp
../../src/test/efsw-test.cpp
../../src/efsw/WatcherKqueue.hpp
../../src/efsw/WatcherInotify.hpp
../../src/efsw/WatcherGeneric.hpp
../../src/efsw/Utf.hpp
../../src/efsw/Thread.hpp
../../src/efsw/System.hpp
../../src/efsw/String.hpp
../../src/efsw/Mutex.hpp
../../src/efsw/FileWatcherWin32.hpp
../../src/efsw/FileWatcherKqueue.hpp
../../src/efsw/FileWatcherInotify.hpp
../../src/efsw/FileWatcherImpl.hpp
../../src/efsw/FileWatcherGeneric.hpp
../../src/efsw/FileSystem.hpp
../../src/efsw/FileInfo.hpp
../../src/efsw/DirWatcherGeneric.hpp
../../src/efsw/Debug.hpp
../../src/efsw/base.hpp
../../src/efsw/sophist.h
../../src/efsw/Utf.inl
../../src/efsw/WatcherKqueue.cpp
../../src/efsw/WatcherInotify.cpp
../../src/efsw/WatcherGeneric.cpp
../../src/efsw/Thread.cpp
../../src/efsw/System.cpp
../../src/efsw/String.cpp
../../src/efsw/Mutex.cpp
../../src/efsw/Log.cpp
../../src/efsw/FileWatcherWin32.cpp
../../src/efsw/FileWatcherKqueue.cpp
../../src/efsw/FileWatcherInotify.cpp
../../src/efsw/FileWatcherGeneric.cpp
../../src/efsw/FileWatcher.cpp
../../src/efsw/FileSystem.cpp
../../src/efsw/FileInfo.cpp
../../src/efsw/DirWatcherGeneric.cpp
../../src/efsw/Debug.cpp
../../premake4.lua
../../src/efsw/WatcherKqueue.hpp
../../src/efsw/WatcherInotify.hpp
../../src/efsw/WatcherGeneric.hpp
../../src/efsw/Utf.hpp
../../src/efsw/Thread.hpp
../../src/efsw/System.hpp
../../src/efsw/String.hpp
../../src/efsw/sophist.h
../../src/efsw/Mutex.hpp
../../src/efsw/FileWatcherWin32.hpp
../../src/efsw/FileWatcherKqueue.hpp
../../src/efsw/FileWatcherInotify.hpp
../../src/efsw/FileWatcherImpl.hpp
../../src/efsw/FileWatcherGeneric.hpp
../../src/efsw/FileSystem.hpp
../../src/efsw/FileInfo.hpp
../../src/efsw/DirWatcherGeneric.hpp
../../src/efsw/Debug.hpp
../../src/efsw/base.hpp
../../src/efsw/Utf.inl
../../src/efsw/WatcherKqueue.cpp
../../src/efsw/WatcherInotify.cpp
../../src/efsw/WatcherGeneric.cpp
../../src/efsw/Thread.cpp
../../src/efsw/System.cpp
../../src/efsw/String.cpp
../../src/efsw/Mutex.cpp
../../src/efsw/Log.cpp
../../src/efsw/FileWatcherWin32.cpp
../../src/efsw/FileWatcherKqueue.cpp
../../src/efsw/FileWatcherInotify.cpp
../../src/efsw/FileWatcherImpl.cpp
../../src/efsw/FileWatcherGeneric.cpp
../../src/efsw/FileWatcher.cpp
../../src/efsw/FileSystem.cpp
../../src/efsw/FileInfo.cpp
../../src/efsw/DirWatcherGeneric.cpp
../../src/efsw/Debug.cpp
../../src/efsw/WatcherWin32.hpp
../../src/efsw/WatcherKqueue.hpp
../../src/efsw/WatcherInotify.hpp
../../src/efsw/WatcherGeneric.hpp
../../src/efsw/WatcherFSEvents.hpp
../../src/efsw/Watcher.hpp
../../src/efsw/Utf.hpp
../../src/efsw/Thread.hpp
../../src/efsw/System.hpp
../../src/efsw/String.hpp
../../src/efsw/sophist.h
../../src/efsw/Mutex.hpp
../../src/efsw/FileWatcherWin32.hpp
../../src/efsw/FileWatcherKqueue.hpp
../../src/efsw/FileWatcherInotify.hpp
../../src/efsw/FileWatcherImpl.hpp
../../src/efsw/FileWatcherGeneric.hpp
../../src/efsw/FileWatcherFSEvents.hpp
../../src/efsw/FileSystem.hpp
../../src/efsw/FileInfo.hpp
../../src/efsw/DirWatcherGeneric.hpp
../../src/efsw/DirectorySnapshotDiff.hpp
../../src/efsw/DirectorySnapshot.hpp
../../src/efsw/Debug.hpp
../../src/efsw/base.hpp
../../src/efsw/Utf.inl
../../src/efsw/WatcherWin32.cpp
../../src/efsw/WatcherKqueue.cpp
../../src/efsw/WatcherInotify.cpp
../../src/efsw/WatcherGeneric.cpp
../../src/efsw/WatcherFSEvents.cpp
../../src/efsw/Watcher.cpp
../../src/efsw/Thread.cpp
../../src/efsw/System.cpp
../../src/efsw/String.cpp
../../src/efsw/Mutex.cpp
../../src/efsw/Log.cpp
../../src/efsw/FileWatcherWin32.cpp
../../src/efsw/FileWatcherKqueue.cpp
../../src/efsw/FileWatcherInotify.cpp
../../src/efsw/FileWatcherImpl.cpp
../../src/efsw/FileWatcherGeneric.cpp
../../src/efsw/FileWatcherFSEvents.cpp
../../src/efsw/FileWatcher.cpp
../../src/efsw/FileSystem.cpp
../../src/efsw/FileInfo.cpp
../../src/efsw/DirWatcherGeneric.cpp
../../src/efsw/DirectorySnapshotDiff.cpp
../../src/efsw/DirectorySnapshot.cpp
../../src/efsw/Debug.cpp
../../include/efsw/efsw.h
../../src/efsw/FileWatcherCWrapper.cpp
>>>>>>> 0adf96dcdb6ba38e789d409ca1bf1fc149e60808

View File

@ -0,0 +1,139 @@
#include <efsw/FileSystem.hpp>
#include <efsw/System.hpp>
#include <efsw/efsw.hpp>
#include <iostream>
#include <signal.h>
bool STOP = false;
void sigend( int ) {
std::cout << std::endl << "Bye bye" << std::endl;
STOP = true;
}
/// Processes a file action
class UpdateListener : public efsw::FileWatchListener {
public:
UpdateListener() {}
std::string getActionName( efsw::Action action ) {
switch ( action ) {
case efsw::Actions::Add:
return "Add";
case efsw::Actions::Modified:
return "Modified";
case efsw::Actions::Delete:
return "Delete";
case efsw::Actions::Moved:
return "Moved";
default:
return "Bad Action";
}
}
void handleFileAction( efsw::WatchID watchid, const std::string& dir,
const std::string& filename, efsw::Action action,
std::string oldFilename = "" ) override {
std::cout << "Watch ID " << watchid << " DIR ("
<< dir + ") FILE (" +
( oldFilename.empty() ? "" : "from file " + oldFilename + " to " ) +
filename + ") has event "
<< getActionName( action ) << std::endl;
}
};
efsw::WatchID handleWatchID( efsw::WatchID watchid ) {
switch ( watchid ) {
case efsw::Errors::FileNotFound:
case efsw::Errors::FileRepeated:
case efsw::Errors::FileOutOfScope:
case efsw::Errors::FileRemote:
case efsw::Errors::WatcherFailed:
case efsw::Errors::Unspecified: {
std::cout << efsw::Errors::Log::getLastErrorLog().c_str() << std::endl;
break;
}
default: {
std::cout << "Added WatchID: " << watchid << std::endl;
}
}
return watchid;
}
int main( int argc, char** argv ) {
signal( SIGABRT, sigend );
signal( SIGINT, sigend );
signal( SIGTERM, sigend );
std::cout << "Press ^C to exit demo" << std::endl;
bool commonTest = true;
bool useGeneric = false;
std::string path;
if ( argc >= 2 ) {
path = std::string( argv[1] );
if ( efsw::FileSystem::isDirectory( path ) ) {
commonTest = false;
}
if ( argc >= 3 ) {
if ( std::string( argv[2] ) == "true" ) {
useGeneric = true;
}
}
}
UpdateListener* ul = new UpdateListener();
/// create the file watcher object
efsw::FileWatcher fileWatcher( useGeneric );
fileWatcher.followSymlinks( false );
fileWatcher.allowOutOfScopeLinks( false );
if ( commonTest ) {
std::string CurPath( efsw::System::getProcessPath() );
std::cout << "CurPath: " << CurPath.c_str() << std::endl;
/// starts watching
fileWatcher.watch();
/// add a watch to the system
handleWatchID( fileWatcher.addWatch( CurPath + "test", ul, true ) );
/// adds another watch after started watching...
efsw::System::sleep( 100 );
efsw::WatchID watchID =
handleWatchID( fileWatcher.addWatch( CurPath + "test2", ul, true ) );
/// delete the watch
if ( watchID > 0 ) {
efsw::System::sleep( 1000 );
fileWatcher.removeWatch( watchID );
}
} else {
if ( fileWatcher.addWatch( path, ul, true ) > 0 ) {
fileWatcher.watch();
std::cout << "Watching directory: " << path.c_str() << std::endl;
if ( useGeneric ) {
std::cout << "Using generic backend watcher" << std::endl;
}
} else {
std::cout << "Error trying to watch directory: " << path.c_str() << std::endl;
std::cout << efsw::Errors::Log::getLastErrorLog().c_str() << std::endl;
}
}
while ( !STOP ) {
efsw::System::sleep( 100 );
}
return 0;
}