Subversion Repositories tpanel

Rev

Rev 153 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 153 Rev 186
Line 1... Line 1...
1
/*
1
/*
2
 * Copyright (C) 2021 by Andreas Theofilu <andreas@theosys.at>
2
 * Copyright (C) 2021, 2022 by Andreas Theofilu <andreas@theosys.at>
3
 *
3
 *
4
 * This program is free software; you can redistribute it and/or modify
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
7
 * (at your option) any later version.
Line 19... Line 19...
19
#include "texternal.h"
19
#include "texternal.h"
20
#include "terror.h"
20
#include "terror.h"
21
#include "tconfig.h"
21
#include "tconfig.h"
22
#include "texpat++.h"
22
#include "texpat++.h"
23
 
23
 
-
 
24
#if __cplusplus < 201402L
-
 
25
#   error "This module requires at least C++14 standard!"
-
 
26
#else
-
 
27
#   if __cplusplus < 201703L
-
 
28
#       include <experimental/filesystem>
-
 
29
namespace fs = std::experimental::filesystem;
-
 
30
#       warning "Support for C++14 and experimental filesystem will be removed in a future version!"
-
 
31
#   else
-
 
32
#       include <filesystem>
-
 
33
#       ifdef __ANDROID__
-
 
34
namespace fs = std::__fs::filesystem;
-
 
35
#       else
-
 
36
namespace fs = std::filesystem;
-
 
37
#       endif
-
 
38
#   endif
-
 
39
#endif
-
 
40
 
24
using std::string;
41
using std::string;
25
using std::vector;
42
using std::vector;
26
using namespace Expat;
43
using namespace Expat;
27
 
44
 
28
TExternal::TExternal()
45
TExternal::TExternal()
29
{
46
{
30
    DECL_TRACER("TExternal::TExternal()");
47
    DECL_TRACER("TExternal::TExternal()");
31
 
48
 
-
 
49
    string projectPath = TConfig::getProjectPath();
-
 
50
 
-
 
51
    if (!fs::exists(projectPath + "/prj.xma"))
-
 
52
        projectPath += "/__system";
-
 
53
 
32
    makeFileName(TConfig::getProjectPath(), "external.xma");
54
    makeFileName(projectPath, "external.xma");
33
 
55
 
34
    if (!isValidFile())
56
    if (!isValidFile())
35
    {
57
    {
36
        TError::setErrorMsg(TERRERROR, "Invalid file name " + getFileName());
58
        TError::setErrorMsg(TERRERROR, "Invalid file name " + getFileName());
37
        return;
59
        return;
Line 43... Line 65...
43
 
65
 
44
void TExternal::setFileName(const string &fn)
66
void TExternal::setFileName(const string &fn)
45
{
67
{
46
    DECL_TRACER("TExternal::setFileName(const string &fn)");
68
    DECL_TRACER("TExternal::setFileName(const string &fn)");
47
 
69
 
-
 
70
    string projectPath = TConfig::getProjectPath();
-
 
71
 
-
 
72
    if (!fs::exists(projectPath + "/prj.xma"))
-
 
73
        projectPath += "/__system";
-
 
74
 
48
    makeFileName(TConfig::getProjectPath(), fn);
75
    makeFileName(projectPath, fn);
49
 
76
 
50
    if (!isValidFile())
77
    if (!isValidFile())
51
    {
78
    {
52
        TError::setErrorMsg(TERRERROR, "Invalid file name " + getFileName());
79
        TError::setErrorMsg(TERRERROR, "Invalid file name " + getFileName());
53
        return;
80
        return;