Changeset 3860 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jul 26, 2007 9:13:25 AM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 23219
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/path.cpp
r3672 r3860 34 34 #include <iprt/uni.h> 35 35 #include "internal/fs.h" 36 #include "internal/path.h" 36 37 37 38 … … 547 548 } 548 549 550 551 /** 552 * Gets the directory for architecture-independent application data, for 553 * example NLS files, module sources, ... 554 * 555 * Linux: /usr/shared/<application> 556 * Windows: <program files directory>/<application> 557 * Old path: same as RTPathProgram() 558 * 559 */ 560 RTDECL(int) RTPathAppPrivateNoArch(char *pszPath, unsigned cchPath) 561 { 562 #ifdef RTPATH_APP_PRIVATE 563 char *pszUtf8Path; 564 int rc; 565 rc = rtPathFromNative(&pszUtf8Path, RTPATH_APP_PRIVATE); 566 if (RT_SUCCESS(rc)) 567 { 568 size_t cchPathPrivateNoArch = strlen(pszUtf8Path); 569 if (cchPathPrivateNoArch < cchPath) 570 memcpy(pszPath, pszUtf8Path, cchPathPrivateNoArch + 1); 571 else 572 rc = VERR_BUFFER_OVERFLOW; 573 RTStrFree(pszUtf8Path); 574 } 575 return rc; 576 #else 577 return RTPathProgram(pszPath, cchPath); 578 #endif 579 } 580 581 582 /** 583 * Gets the directory for architecture-dependent application data, for 584 * example modules which can be loaded at runtime. 585 * 586 * Linux: /usr/lib/<application> 587 * Windows: <program files directory>/<application> 588 * Old path: same as RTPathProgram() 589 * 590 * @returns iprt status code. 591 * @param pszPath Buffer where to store the path. 592 * @param cchPath Buffer size in bytes. 593 */ 594 RTDECL(int) RTPathAppPrivateArch(char *pszPath, unsigned cchPath) 595 { 596 #ifdef RTPATH_APP_PRIVATE_ARCH 597 char *pszUtf8Path; 598 int rc; 599 rc = rtPathFromNative(&pszUtf8Path, RTPATH_APP_PRIVATE_ARCH); 600 if (RT_SUCCESS(rc)) 601 { 602 size_t cchPathPrivateArch = strlen(pszUtf8Path); 603 if (cchPathPrivateArch < cchPath) 604 memcpy(pszPath, pszUtf8Path, cchPathPrivateArch + 1); 605 else 606 rc = VERR_BUFFER_OVERFLOW; 607 RTStrFree(pszUtf8Path); 608 } 609 return rc; 610 #else 611 return RTPathProgram(pszPath, cchPath); 612 #endif 613 } 614 615 616 /** 617 * Gets the directory of shared libraries. This is not the same as 618 * RTPathAppPrivateArch() as Linux depends all shared libraries in 619 * a common global directory where ld.so can found them. 620 * 621 * Linux: /usr/lib 622 * Windows: <program files directory>/<application> 623 * Old path: same as RTPathProgram() 624 * 625 * @returns iprt status code. 626 * @param pszPath Buffer where to store the path. 627 * @param cchPath Buffer size in bytes. 628 */ 629 RTDECL(int) RTPathSharedLibs(char *pszPath, unsigned cchPath) 630 { 631 #ifdef RTPATH_SHARED_LIBS 632 char *pszUtf8Path; 633 int rc; 634 rc = rtPathFromNative(&pszUtf8Path, RTPATH_SHARED_LIBS); 635 if (RT_SUCCESS(rc)) 636 { 637 size_t cchPathSharedLibs = strlen(pszUtf8Path); 638 if (cchPathSharedLibs < cchPath) 639 memcpy(pszPath, pszUtf8Path, cchPathSharedLibs + 1); 640 else 641 rc = VERR_BUFFER_OVERFLOW; 642 RTStrFree(pszUtf8Path); 643 } 644 return rc; 645 #else 646 return RTPathProgram(pszPath, cchPath); 647 #endif 648 } 649 650 651 /** 652 * Gets the directory for documentation. 653 * 654 * Linux: /usr/share/doc/<application> 655 * Windows: <program files directory>/<application> 656 * Old path: same as RTPathProgram() 657 * 658 * @returns iprt status code. 659 * @param pszPath Buffer where to store the path. 660 * @param cchPath Buffer size in bytes. 661 */ 662 RTDECL(int) RTPathAppDocs(char *pszPath, unsigned cchPath) 663 { 664 #ifdef RTPATH_APP_DOCS 665 char *pszUtf8Path; 666 int rc; 667 rc = rtPathFromNative(&pszUtf8Path, RTPATH_APP_DOCS); 668 if (RT_SUCCESS(rc)) 669 { 670 size_t cchPathAppDocs = strlen(pszUtf8Path); 671 if (cchPathAppDocs < cchPath) 672 memcpy(pszPath, pszUtf8Path, cchPathAppDocs + 1); 673 else 674 rc = VERR_BUFFER_OVERFLOW; 675 RTStrFree(pszUtf8Path); 676 } 677 return rc; 678 #else 679 return RTPathProgram(pszPath, cchPath); 680 #endif 681 }
Note:
See TracChangeset
for help on using the changeset viewer.