| 636 | } |
| 637 | |
| 638 | string getDasRoot ( void ) { |
| 639 | if ( g_dasRoot.empty() ) { |
| 640 | string efp = getExecutableFileName(); // ?/bin/debug/binary.exe |
| 641 | auto np = efp.find_last_of("\\/"); |
| 642 | if ( np != string::npos ) { |
| 643 | auto ep = get_prefix(efp); // remove file name |
| 644 | auto suffix = get_suffix(ep); |
| 645 | if ( suffix != "bin" ) { |
| 646 | ep = get_prefix(ep); // remove debug |
| 647 | } |
| 648 | if ( get_suffix(ep)!="bin" ) { |
| 649 | g_dasRoot = "."; |
| 650 | } else { |
| 651 | g_dasRoot = get_prefix(ep); // remove bin |
| 652 | } |
| 653 | #ifdef DAS_INSTALL_BINDIR |
| 654 | if ( ep == DAS_INSTALL_BINDIR ) { |
| 655 | g_dasRoot = DAS_INSTALL_DATADIR; |
| 656 | } |
| 657 | #endif |
| 658 | // make paths consistent on UNIX and Windows |
| 659 | replace(g_dasRoot.begin(), g_dasRoot.end(), '\\', '/'); |
| 660 | } else { |
| 661 | g_dasRoot = "."; |
| 662 | } |
| 663 | } |
| 664 | return g_dasRoot; |
| 665 | } |
| 666 | } |
no test coverage detected