Ignore:
Timestamp:
Feb 3, 2002, 10:06:40 PM (24 years ago)
Author:
sandervl
Message:

Ported GetTempPathA/W from Wine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kernel32/directory.cpp

    r7342 r7798  
    1 /* $Id: directory.cpp,v 1.42 2001-11-14 18:38:45 sandervl Exp $ */
     1/* $Id: directory.cpp,v 1.43 2002-02-03 21:06:40 sandervl Exp $ */
    22
    33/*
     
    754754    return ret;
    755755}
     756//******************************************************************************
     757//******************************************************************************
     758ODINFUNCTION2(UINT, GetTempPathA,
     759              UINT, count, LPSTR, path)
     760{
     761    UINT ret;
     762    if (!(ret = GetEnvironmentVariableA( "TMP", path, count )))
     763        if (!(ret = GetEnvironmentVariableA( "TEMP", path, count )))
     764            if (!(ret = GetCurrentDirectoryA( count, path )))
     765                return 0;
     766    if (count && (ret < count - 1) && (path[ret-1] != '\\'))
     767    {
     768        path[ret++] = '\\';
     769        path[ret]   = '\0';
     770    }
     771    return ret;
     772}
     773//******************************************************************************
     774//******************************************************************************
     775ODINFUNCTION2(UINT, GetTempPathW,
     776              UINT, count, LPWSTR, path)
     777{
     778    static const WCHAR tmp[]  = { 'T', 'M', 'P', 0 };
     779    static const WCHAR temp[] = { 'T', 'E', 'M', 'P', 0 };
     780    UINT ret;
     781    if (!(ret = GetEnvironmentVariableW( tmp, path, count )))
     782        if (!(ret = GetEnvironmentVariableW( temp, path, count )))
     783            if (!(ret = GetCurrentDirectoryW( count, path )))
     784                return 0;
     785    if (count && (ret < count - 1) && (path[ret-1] != '\\'))
     786    {
     787        path[ret++] = '\\';
     788        path[ret]   = '\0';
     789    }
     790    return ret;
     791}
     792//******************************************************************************
     793//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.