diff options
author | Li Jin <dragon-fly@qq.com> | 2023-12-07 16:18:50 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2023-12-07 16:18:50 +0800 |
commit | a1d719e3bbfe8cd39c05d2a8f49143b9e814f876 (patch) | |
tree | 218c66848de8923dc112a562e089d8b61396ba99 /src | |
parent | f61a1559846e5b03cc8106c4d35397f63aa9aad0 (diff) | |
download | yuescript-a1d719e3bbfe8cd39c05d2a8f49143b9e814f876.tar.gz yuescript-a1d719e3bbfe8cd39c05d2a8f49143b9e814f876.tar.bz2 yuescript-a1d719e3bbfe8cd39c05d2a8f49143b9e814f876.zip |
fixing issue #157.
Diffstat (limited to 'src')
-rwxr-xr-x | src/3rdParty/efsw/FileInfo.cpp | 14 | ||||
-rw-r--r-- | src/3rdParty/linenoise.hpp | 13 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/3rdParty/efsw/FileInfo.cpp b/src/3rdParty/efsw/FileInfo.cpp index 707f617..072cd6d 100755 --- a/src/3rdParty/efsw/FileInfo.cpp +++ b/src/3rdParty/efsw/FileInfo.cpp | |||
@@ -35,6 +35,10 @@ | |||
35 | #endif | 35 | #endif |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #if EFSW_PLATFORM != EFSW_PLATFORM_WIN32 | ||
39 | #include <filesystem> | ||
40 | #endif | ||
41 | |||
38 | namespace efsw { | 42 | namespace efsw { |
39 | 43 | ||
40 | bool FileInfo::exists( const std::string& filePath ) { | 44 | bool FileInfo::exists( const std::string& filePath ) { |
@@ -182,14 +186,12 @@ bool FileInfo::isLink() const { | |||
182 | std::string FileInfo::linksTo() { | 186 | std::string FileInfo::linksTo() { |
183 | #if EFSW_PLATFORM != EFSW_PLATFORM_WIN32 | 187 | #if EFSW_PLATFORM != EFSW_PLATFORM_WIN32 |
184 | if ( isLink() ) { | 188 | if ( isLink() ) { |
185 | char* ch = realpath( Filepath.c_str(), NULL ); | 189 | std::error_code ec; |
186 | 190 | auto ch = std::filesystem::canonical( Filepath, ec ); | |
187 | if ( NULL != ch ) { | ||
188 | std::string tstr( ch ); | ||
189 | 191 | ||
190 | free( ch ); | 192 | if ( !ec ) { |
191 | 193 | ||
192 | return tstr; | 194 | return ch.string(); |
193 | } | 195 | } |
194 | } | 196 | } |
195 | #endif | 197 | #endif |
diff --git a/src/3rdParty/linenoise.hpp b/src/3rdParty/linenoise.hpp index 604f889..b5b0efa 100644 --- a/src/3rdParty/linenoise.hpp +++ b/src/3rdParty/linenoise.hpp | |||
@@ -1578,6 +1578,17 @@ inline void SetMultiLine(bool ml) { | |||
1578 | mlmode = ml; | 1578 | mlmode = ml; |
1579 | } | 1579 | } |
1580 | 1580 | ||
1581 | inline int Strcasecmp(const char *a, const char *b) { | ||
1582 | int ca, cb; | ||
1583 | do { | ||
1584 | ca = (unsigned char) *a; a++; | ||
1585 | cb = (unsigned char) *b; b++; | ||
1586 | ca = tolower(toupper(ca)); | ||
1587 | cb = tolower(toupper(cb)); | ||
1588 | } while (ca == cb && ca != '\0'); | ||
1589 | return ca - cb; | ||
1590 | } | ||
1591 | |||
1581 | /* Return true if the terminal name is in the list of terminals we know are | 1592 | /* Return true if the terminal name is in the list of terminals we know are |
1582 | * not able to understand basic escape sequences. */ | 1593 | * not able to understand basic escape sequences. */ |
1583 | inline bool isUnsupportedTerm(void) { | 1594 | inline bool isUnsupportedTerm(void) { |
@@ -1587,7 +1598,7 @@ inline bool isUnsupportedTerm(void) { | |||
1587 | 1598 | ||
1588 | if (term == NULL) return false; | 1599 | if (term == NULL) return false; |
1589 | for (j = 0; unsupported_term[j]; j++) | 1600 | for (j = 0; unsupported_term[j]; j++) |
1590 | if (!strcasecmp(term,unsupported_term[j])) return true; | 1601 | if (!Strcasecmp(term,unsupported_term[j])) return true; |
1591 | #endif | 1602 | #endif |
1592 | return false; | 1603 | return false; |
1593 | } | 1604 | } |