Subversion Repository Public Repository

Divide-Framework

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "stdafx.h"

#include "Headers/FileUpdateMonitor.h"
#include "Platform/File/Headers/FileManagement.h"

namespace Divide {

UpdateListener::UpdateListener(const FileUpdateCbk& cbk)
    : _cbk(cbk)
{
}

void UpdateListener::addIgnoredExtension(const char* extension) {
    _ignoredExtensions.emplace_back(extension);
}

void UpdateListener::addIgnoredEndCharacter(char character) {
    _ignoredEndingCharacters.emplace_back(character);
}

void UpdateListener::handleFileAction(FW::WatchID watchid, const FW::String& dir, const FW::String& filename, FW::Action action)
{
    // We can ignore files that end in a specific character. Many text editors, for examnple, append a '~' at the end of temp files
    if (!_ignoredEndingCharacters.empty()) {
        if (std::find_if(std::cbegin(_ignoredEndingCharacters),
            std::cend(_ignoredEndingCharacters),
            [filename](char character) {
            return std::tolower(filename.back()) == std::tolower(character);
        }) != std::cend(_ignoredEndingCharacters)) {
            return;
        }
    }

    // We can specify a list of extensions to ignore for a specific listener to avoid, for example, parsing temporary OS files
    if (!_ignoredExtensions.empty()) {
        if (std::find_if(std::cbegin(_ignoredExtensions),
            std::cend(_ignoredExtensions),
            [filename](const stringImpl& extension) {
            return hasExtension(filename, extension);
        }) != std::cend(_ignoredExtensions)) {
            return;
        }
    }
    if (_cbk) {
        FileUpdateEvent evt = FileUpdateEvent::COUNT;
        switch (action)
        {
        case FW::Actions::Add: evt = FileUpdateEvent::ADD; break;
        case FW::Actions::Delete: evt = FileUpdateEvent::DELETE; break;
        case FW::Actions::Modified: evt = FileUpdateEvent::MODIFY; break;
        default: DIVIDE_UNEXPECTED_CALL("Unknown file event!");
        }

        _cbk(filename.c_str(), evt);
    }
}

}; //namespace Divide;

Commits for Divide-Framework/trunk/Source Code/Platform/File/FileUpdateMonitor.cpp

Diff revisions: vs.
Revision Author Commited Message
893 IonutCava picture IonutCava Sun 18 Jun, 2017 17:33:07 +0000

[Ionut]
- Initial implementation of a PipelineStateObject (holds shader program, rasterizer state, etc)
- Rework PCH implementation a bit because VS2017 no longer has a /ZM option