git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13124
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
(although :filename works as well).
Since the volume is just part of the file path, it is not
treated like a separate entity as it is done under DOS and
(although :filename works as well).
Since the volume is just part of the file path, it is not
treated like a separate entity as it is done under DOS and
- VMS, it is just treated as another dir.
+ VMS, it is just treated as another dir.
wxPATH_VMS: VMS native format, absolute file names have the form
<device>:[dir1.dir2.dir3]file.txt
wxPATH_VMS: VMS native format, absolute file names have the form
<device>:[dir1.dir2.dir3]file.txt
{
wxPathFormat my_format = GetFormat( format );
wxString my_path = path;
{
wxPathFormat my_format = GetFormat( format );
wxString my_path = path;
if (!my_path.empty())
{
// 1) Determine if the path is relative or absolute.
if (!my_path.empty())
{
// 1) Determine if the path is relative or absolute.
switch (my_format)
{
case wxPATH_MAC:
switch (my_format)
{
case wxPATH_MAC:
// We then remove a leading ":". The reason is in our
// storage form for relative paths:
// ":dir:file.txt" actually means "./dir/file.txt" in
// We then remove a leading ":". The reason is in our
// storage form for relative paths:
// ":dir:file.txt" actually means "./dir/file.txt" in
- // DOS notation and should get stored as
+ // DOS notation and should get stored as
// (relative) (dir) (file.txt)
// "::dir:file.txt" actually means "../dir/file.txt"
// stored as (relative) (..) (dir) (file.txt)
// (relative) (dir) (file.txt)
// "::dir:file.txt" actually means "../dir/file.txt"
// stored as (relative) (..) (dir) (file.txt)
wxFAIL_MSG( wxT("error") );
break;
}
wxFAIL_MSG( wxT("error") );
break;
}
// 2) Break up the path into its members. If the original path
// was just "/" or "\\", m_dirs will be empty. We know from
// the m_relative field, if this means "nothing" or "root dir".
// 2) Break up the path into its members. If the original path
// was just "/" or "\\", m_dirs will be empty. We know from
// the m_relative field, if this means "nothing" or "root dir".
wxStringTokenizer tn( my_path, GetPathSeparators(my_format) );
while ( tn.HasMoreTokens() )
wxStringTokenizer tn( my_path, GetPathSeparators(my_format) );
while ( tn.HasMoreTokens() )
#ifndef __WATCOMC__
::DosCreateDir(wxStringBuffer(path, MAX_PATH), NULL);
#endif
#ifndef __WATCOMC__
::DosCreateDir(wxStringBuffer(path, MAX_PATH), NULL);
#endif
#else // !Windows, !OS/2
if ( dir.empty() )
{
#else // !Windows, !OS/2
if ( dir.empty() )
{
{
// open the file - of course, there is a race condition here, this is
// why we always prefer using mkstemp()...
{
// open the file - of course, there is a race condition here, this is
// why we always prefer using mkstemp()...
- if ( !fileTemp->Open(path, wxFile::write_excl, wxS_IRUSR | wxS_IWUSR) )
+ //
+ // NB: GetTempFileName() under Windows creates the file, so using
+ // write_excl there would fail
+ if ( !fileTemp->Open(path,
+#if defined(__WINDOWS__) && !defined(__WXMICROWIN__)
+ wxFile::write,
+#else
+ wxFile::write_excl,
+#endif
+ wxS_IRUSR | wxS_IWUSR) )
{
// FIXME: If !ok here should we loop and try again with another
// file name? That is the standard recourse if open(O_EXCL)
{
// FIXME: If !ok here should we loop and try again with another
// file name? That is the standard recourse if open(O_EXCL)
{
m_dirs.Insert(wxT(".."), 0u);
}
{
m_dirs.Insert(wxT(".."), 0u);
}
m_relative = TRUE;
// we were modified
m_relative = TRUE;
// we were modified
if (!m_relative)
fullpath += wxFILE_SEP_PATH_UNIX;
}
if (!m_relative)
fullpath += wxFILE_SEP_PATH_UNIX;
}
// then concatenate all the path components using the path separator
size_t dirCount = m_dirs.GetCount();
if ( dirCount )
// then concatenate all the path components using the path separator
size_t dirCount = m_dirs.GetCount();
if ( dirCount )
// the leading character
if ( format == wxPATH_MAC && m_relative )
{
// the leading character
if ( format == wxPATH_MAC && m_relative )
{
if (!m_relative)
fullpath += wxFILE_SEP_PATH_UNIX;
}
if (!m_relative)
fullpath += wxFILE_SEP_PATH_UNIX;
}
// then concatenate all the path components using the path separator
size_t dirCount = m_dirs.GetCount();
if ( dirCount )
// then concatenate all the path components using the path separator
size_t dirCount = m_dirs.GetCount();
if ( dirCount )