make sure file separators are correct type (Windows or Linux) remove ending file separator remove beginning file separator if requested and NOT a complete file path
| 1823 | // remove ending file separator |
| 1824 | // remove beginning file separator if requested and NOT a complete file path |
| 1825 | void ASConsole::standardizePath(string& path, bool removeBeginningSeparator /*false*/) const |
| 1826 | { |
| 1827 | #ifdef __VMS |
| 1828 | struct FAB fab; |
| 1829 | struct NAML naml; |
| 1830 | char less[NAML$C_MAXRSS]; |
| 1831 | char sess[NAM$C_MAXRSS]; |
| 1832 | int r0_status; |
| 1833 | |
| 1834 | // If we are on a VMS system, translate VMS style filenames to unix |
| 1835 | // style. |
| 1836 | fab = cc$rms_fab; |
| 1837 | fab.fab$l_fna = (char*)-1; |
| 1838 | fab.fab$b_fns = 0; |
| 1839 | fab.fab$l_naml = &naml; |
| 1840 | naml = cc$rms_naml; |
| 1841 | strcpy (sess, path.c_str()); |
| 1842 | naml.naml$l_long_filename = (char*)sess; |
| 1843 | naml.naml$l_long_filename_size = path.length(); |
| 1844 | naml.naml$l_long_expand = less; |
| 1845 | naml.naml$l_long_expand_alloc = sizeof (less); |
| 1846 | naml.naml$l_esa = sess; |
| 1847 | naml.naml$b_ess = sizeof (sess); |
| 1848 | naml.naml$v_no_short_upcase = 1; |
| 1849 | r0_status = sys$parse (&fab); |
| 1850 | if (r0_status == RMS$_SYN) |
| 1851 | { |
| 1852 | error("File syntax error", path.c_str()); |
| 1853 | } |
| 1854 | else |
| 1855 | { |
| 1856 | if (!$VMS_STATUS_SUCCESS(r0_status)) |
| 1857 | { |
| 1858 | (void)lib$signal (r0_status); |
| 1859 | } |
| 1860 | } |
| 1861 | less[naml.naml$l_long_expand_size - naml.naml$b_ver] = '\0'; |
| 1862 | sess[naml.naml$b_esl - naml.naml$b_ver] = '\0'; |
| 1863 | if (naml.naml$l_long_expand_size > naml.naml$b_esl) |
| 1864 | { |
| 1865 | path = decc$translate_vms (less); |
| 1866 | } |
| 1867 | else |
| 1868 | { |
| 1869 | path = decc$translate_vms (sess); |
| 1870 | } |
| 1871 | #endif /* __VMS */ |
| 1872 | |
| 1873 | // make sure separators are correct type (Windows or Linux) |
| 1874 | for (size_t i = 0; i < path.length(); i++) |
| 1875 | { |
| 1876 | i = path.find_first_of("/\\", i); |
| 1877 | if (i == string::npos) |
| 1878 | break; |
| 1879 | path[i] = g_fileSeparator; |
| 1880 | } |
| 1881 | // The following was removed in release 2.02 - jimp |
| 1882 | // // remove separator from the end |