VirtualBox

Changeset 2933 in vbox


Ignore:
Timestamp:
May 30, 2007 2:56:43 PM (18 years ago)
Author:
vboxsync
Message:

Make '.' mean hidden when converting from unix to dos file mode.

Location:
trunk/src/VBox/Runtime
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/fs.cpp

    r1 r2933  
    3333#include <iprt/time.h>
    3434#include <iprt/string.h>
     35#include <iprt/path.h>
    3536#include <iprt/ctype.h>
    3637#include "internal/fs.h"
     
    9091 * @param   fMode       The mode mask containing dos-style attibutes only.
    9192 */
    92 RTFMODE rtFsModeFromUnix(RTFMODE fMode)
     93RTFMODE rtFsModeFromUnix(RTFMODE fMode, const char *pszName, unsigned cbName)
    9394{
    9495    fMode &= RTFS_UNIX_MASK;
     
    100101    if (!(fMode & RTFS_DOS_MASK))
    101102        fMode |= RTFS_DOS_NT_NORMAL;
     103    if (!(fMode & RTFS_DOS_HIDDEN) && pszName)
     104    {
     105        pszName = RTPathFilename(pszName);
     106        if (pszName && *pszName == '.')
     107            fMode |= RTFS_DOS_HIDDEN;
     108    }
    102109    return fMode;
    103110}
     
    117124        rtFsModeFromDos(fMode, pszName, cbName);
    118125    else if (!(fMode & RTFS_DOS_MASK))
    119         rtFsModeFromUnix(fMode);
     126        rtFsModeFromUnix(fMode, pszName, cbName);
    120127    else if (!(fMode & RTFS_TYPE_MASK))
    121128        fMode |= fMode & RTFS_DOS_DIRECTORY ? RTFS_TYPE_DIRECTORY : RTFS_TYPE_FILE;
     
    169176 * @param   pStat           The stat structure to use.
    170177 */
    171 void rtFsConvertStatToObjInfo(PRTFSOBJINFO pObjInfo, const struct stat *pStat)
     178void rtFsConvertStatToObjInfo(PRTFSOBJINFO pObjInfo, const struct stat *pStat, const char *pszName, unsigned cbName)
    172179{
    173180    pObjInfo->cbObject    = pStat->st_size;
     
    246253    Assert(RTFS_TYPE_MASK == S_IFMT);
    247254
    248     pObjInfo->Attr.fMode  = rtFsModeFromUnix(fMode);
     255    pObjInfo->Attr.fMode  = rtFsModeFromUnix(fMode, pszName, cbName);
    249256
    250257    /* additional unix attribs */
  • trunk/src/VBox/Runtime/include/internal/fs.h

    r1 r2933  
    3131
    3232RTFMODE rtFsModeFromDos(RTFMODE fMode, const char *pszName, unsigned cbName);
    33 RTFMODE rtFsModeFromUnix(RTFMODE fMode);
     33RTFMODE rtFsModeFromUnix(RTFMODE fMode, const char *pszName, unsigned cbName);
    3434RTFMODE rtFsModeNormalize(RTFMODE fMode, const char *pszName, unsigned cbName);
    3535bool    rtFsModeIsValid(RTFMODE fMode);
     
    3838size_t  rtPathVolumeSpecLen(const char *pszPath);
    3939#ifndef __WIN__
    40 void    rtFsConvertStatToObjInfo(PRTFSOBJINFO pObjInfo, const struct stat *pStat);
     40void    rtFsConvertStatToObjInfo(PRTFSOBJINFO pObjInfo, const struct stat *pStat, const char *pszName, unsigned cbName);
    4141#endif
    4242
  • trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp

    r1387 r2933  
    425425     * Setup the returned data.
    426426     */
    427     rtFsConvertStatToObjInfo(pObjInfo, &Stat);
     427    rtFsConvertStatToObjInfo(pObjInfo, &Stat, NULL, 0);
    428428
    429429    /*
  • trunk/src/VBox/Runtime/r3/posix/path-posix.cpp

    r937 r2933  
    337337# else
    338338        int cchLink = readlink("/proc/curproc/file", &g_szrtProgramPath[0], sizeof(g_szrtProgramPath) - 1);
    339 # endif         
     339# endif
    340340        if (cchLink < 0 || cchLink == sizeof(g_szrtProgramPath) - 1)
    341341        {
     
    465465        if (!stat(pszNativePath, &Stat))
    466466        {
    467             rtFsConvertStatToObjInfo(pObjInfo, &Stat);
     467            rtFsConvertStatToObjInfo(pObjInfo, &Stat, pszPath, 0);
    468468            switch (enmAdditionalAttribs)
    469469            {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette