Changeset 33337 in vbox for trunk/src/VBox/Runtime/r3
- Timestamp:
- Oct 22, 2010 10:24:50 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 66918
- Location:
- trunk/src/VBox/Runtime/r3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/posix/path-posix.cpp
r31406 r33337 479 479 } 480 480 481 RTR3DECL(int) RTReadLink(const char *pszPath, char *pszDestLink, size_t cchDestLink) 482 { 483 char szNativeDest[RTPATH_MAX]; 484 485 /* 486 * Validate input. 487 */ 488 AssertPtrReturn(pszPath, VERR_INVALID_POINTER); 489 AssertReturn(*pszPath, VERR_INVALID_PARAMETER); 490 AssertPtrReturn(pszDestLink, VERR_INVALID_POINTER); 491 492 /* 493 * Convert the filename. 494 */ 495 char const *pszNativePath; 496 int rc = rtPathToNative(&pszNativePath, pszPath, NULL); 497 if (RT_SUCCESS(rc)) 498 { 499 ssize_t cchLink = readlink(pszNativePath, szNativeDest, RTPATH_MAX-1); 500 if (RT_LIKELY(cchLink != -1)) 501 { 502 szNativeDest[RT_MIN(cchLink, (ssize_t)sizeof(RTPATH_MAX-1))] = '\0'; 503 rc = rtPathFromNativeCopy(pszDestLink, cchDestLink, szNativeDest, NULL); 504 } 505 else 506 rc = RTErrConvertFromErrno(errno); 507 508 rtPathFreeNative(pszNativePath, pszPath); 509 } 510 511 LogFlow(("RTReadlink(%p:{%s}, pObjInfo=%p): returns %Rrc\n", 512 pszPath, pszPath, pObjInfo, rc)); 513 return rc; 514 } 481 515 482 516 RTR3DECL(int) RTPathSetTimes(const char *pszPath, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, … … 868 902 869 903 904 RTR3DECL(int) RTSymlink(const char *pszNewPath, const char *pszOldPath) 905 { 906 /* 907 * Validate input. 908 */ 909 AssertMsgReturn(VALID_PTR(pszNewPath), ("%p\n", pszNewPath), VERR_INVALID_POINTER); 910 AssertMsgReturn(VALID_PTR(pszOldPath), ("%p\n", pszOldPath), VERR_INVALID_POINTER); 911 AssertMsgReturn(*pszNewPath, ("%p\n", pszNewPath), VERR_INVALID_PARAMETER); 912 AssertMsgReturn(*pszOldPath, ("%p\n", pszOldPath), VERR_INVALID_PARAMETER); 913 914 /* 915 * Convert the filenames. 916 */ 917 char const *pszNativeNewPath; 918 char const *pszNativeOldPath; 919 int rc = rtPathToNative(&pszNativeNewPath, pszNewPath, NULL); 920 if (RT_SUCCESS(rc)) 921 { 922 rc = rtPathToNative(&pszNativeOldPath, pszOldPath, NULL); 923 if (RT_SUCCESS(rc)) 924 { 925 if (symlink(pszOldPath, pszNewPath) == -1) 926 rc = RTErrConvertFromErrno(errno); 927 928 rtPathFreeNative(pszNativeOldPath, pszOldPath); 929 } 930 rtPathFreeNative(pszNativeNewPath, pszNewPath); 931 } 932 933 return rc; 934 } 935 936 870 937 RTDECL(bool) RTPathExists(const char *pszPath) 871 938 { -
trunk/src/VBox/Runtime/r3/win/path-win.cpp
r28918 r33337 298 298 299 299 return VINF_SUCCESS; 300 } 301 302 303 RTR3DECL(int) RTReadLink(const char *pszPath, char *pszDestLink, size_t cchDestLink) 304 { 305 return VERR_NOT_IMPLEMENTED; 300 306 } 301 307 … … 499 505 500 506 507 RTR3DECL(int) RTSymlink(const char *pszNewPath, const char *pszOldPath) 508 { 509 return VERR_NOT_IMPLEMENTED; 510 } 511 512 501 513 RTDECL(bool) RTPathExists(const char *pszPath) 502 514 {
Note:
See TracChangeset
for help on using the changeset viewer.