MCPcopy Create free account
hub / github.com/dirkvranckaert/AndroidDecompiler / standardizePath

Method standardizePath

astyle/src/astyle_main.cpp:1888–1951  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1886// remove ending file separator
1887// remove beginning file separator if requested and NOT a complete file path
1888void ASConsole::standardizePath(string &path, bool removeBeginningSeparator /*false*/) const
1889{
1890#ifdef __VMS
1891 struct FAB fab;
1892 struct NAML naml;
1893 char less[NAML$C_MAXRSS];
1894 char sess[NAM$C_MAXRSS];
1895 int r0_status;
1896
1897 // If we are on a VMS system, translate VMS style filenames to unix
1898 // style.
1899 fab = cc$rms_fab;
1900 fab.fab$l_fna = (char*) - 1;
1901 fab.fab$b_fns = 0;
1902 fab.fab$l_naml = &naml;
1903 naml = cc$rms_naml;
1904 strcpy (sess, path.c_str());
1905 naml.naml$l_long_filename = (char*)sess;
1906 naml.naml$l_long_filename_size = path.length();
1907 naml.naml$l_long_expand = less;
1908 naml.naml$l_long_expand_alloc = sizeof (less);
1909 naml.naml$l_esa = sess;
1910 naml.naml$b_ess = sizeof (sess);
1911 naml.naml$v_no_short_upcase = 1;
1912 r0_status = sys$parse (&fab);
1913 if (r0_status == RMS$_SYN)
1914 {
1915 error("File syntax error", path.c_str());
1916 }
1917 else
1918 {
1919 if (!$VMS_STATUS_SUCCESS(r0_status))
1920 {
1921 (void)lib$signal (r0_status);
1922 }
1923 }
1924 less[naml.naml$l_long_expand_size - naml.naml$b_ver] = '\0';
1925 sess[naml.naml$b_esl - naml.naml$b_ver] = '\0';
1926 if (naml.naml$l_long_expand_size > naml.naml$b_esl)
1927 {
1928 path = decc$translate_vms (less);
1929 }
1930 else
1931 {
1932 path = decc$translate_vms (sess);
1933 }
1934#endif /* __VMS */
1935
1936 // make sure separators are correct type (Windows or Linux)
1937 for (size_t i = 0; i < path.length(); i++)
1938 {
1939 i = path.find_first_of("/\\", i);
1940 if (i == string::npos)
1941 break;
1942 path[i] = g_fileSeparator;
1943 }
1944// The following was removed in release 2.02 - jimp
1945// // remove separator from the end

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected