Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 1011 vs 1012 for /trunk/Source Code/Scripting/Script.cpp

Diff revisions: vs.
  @@ -8,6 +8,7 @@
8 8 #include "Utility/Headers/Localization.h"
9 9 #include "Platform/File/Headers/FileManagement.h"
10 10 #include "Platform/File/Headers/FileUpdateMonitor.h"
11 + #include "Platform/File/Headers/FileWatcherManager.h"
11 12
12 13 namespace Divide {
13 14
  @@ -17,7 +18,8 @@
17 18 });
18 19 };
19 20
20 - std::unique_ptr<FW::FileWatcher> Script::s_scriptFileWatcher;
21 + I64 Script::s_scriptFileWatcher = -1;
22 +
21 23 Script::ScriptMap Script::s_scripts;
22 24 bool Script::s_scriptsReady = false;
23 25
  @@ -53,9 +55,6 @@
53 55 }
54 56
55 57 void Script::idle() {
56 - if (!Config::Build::IS_SHIPPING_BUILD) {
57 - s_scriptFileWatcher->update();
58 - }
59 58 }
60 59
61 60 bool Script::onStartup() {
  @@ -63,13 +62,13 @@
63 62 s_scriptsReady = true;
64 63
65 64 if (!Config::Build::IS_SHIPPING_BUILD) {
66 - s_scriptFileWatcher = std::make_unique<FW::FileWatcher>();
65 + FileWatcher& scriptFileWatcher = FileWatcherManager::allocateWatcher();
66 + s_scriptFileWatcher = scriptFileWatcher.getGUID();
67 +
67 68 s_fileWatcherListener.addIgnoredEndCharacter('~');
68 69 s_fileWatcherListener.addIgnoredExtension("tmp");
69 - s_scriptFileWatcher->addWatch(Paths::Scripts::g_scriptsLocation, &s_fileWatcherListener);
70 - s_scriptFileWatcher->addWatch(Paths::Scripts::g_scriptsAtomsLocation, &s_fileWatcherListener);
71 -
72 - return s_scriptFileWatcher != nullptr;
70 + scriptFileWatcher().addWatch(Paths::Scripts::g_scriptsLocation, &s_fileWatcherListener);
71 + scriptFileWatcher().addWatch(Paths::Scripts::g_scriptsAtomsLocation, &s_fileWatcherListener);
73 72 }
74 73
75 74 return true;
  @@ -79,8 +78,8 @@
79 78 s_scriptsReady = false;
80 79
81 80 if (!Config::Build::IS_SHIPPING_BUILD) {
82 - s_scriptFileWatcher.reset();
83 - return s_scriptFileWatcher == nullptr;
81 + FileWatcherManager::deallocateWatcher(s_scriptFileWatcher);
82 + s_scriptFileWatcher = -1;
84 83 }
85 84
86 85 s_scripts.clear();