aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2023-12-07 16:18:50 +0800
committerLi Jin <dragon-fly@qq.com>2023-12-07 16:18:50 +0800
commita1d719e3bbfe8cd39c05d2a8f49143b9e814f876 (patch)
tree218c66848de8923dc112a562e089d8b61396ba99 /src
parentf61a1559846e5b03cc8106c4d35397f63aa9aad0 (diff)
downloadyuescript-a1d719e3bbfe8cd39c05d2a8f49143b9e814f876.tar.gz
yuescript-a1d719e3bbfe8cd39c05d2a8f49143b9e814f876.tar.bz2
yuescript-a1d719e3bbfe8cd39c05d2a8f49143b9e814f876.zip
fixing issue #157.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/3rdParty/efsw/FileInfo.cpp14
-rw-r--r--src/3rdParty/linenoise.hpp13
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
38namespace efsw { 42namespace efsw {
39 43
40bool FileInfo::exists( const std::string& filePath ) { 44bool FileInfo::exists( const std::string& filePath ) {
@@ -182,14 +186,12 @@ bool FileInfo::isLink() const {
182std::string FileInfo::linksTo() { 186std::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
1581inline 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. */
1583inline bool isUnsupportedTerm(void) { 1594inline 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}