FreeRDP
path/shell.c File Reference
#include <winpr/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <winpr/crt.h>
#include <winpr/platform.h>
#include <winpr/file.h>
#include <winpr/tchar.h>
#include <winpr/environment.h>
#include <winpr/path.h>
#include <winpr/wlog.h>
#include "../log.h"
#include <errno.h>
#include <dirent.h>

Macros

#define TAG   WINPR_TAG("path.shell")
 

Functions

static char * GetPath_XDG_CONFIG_HOME (void)
 
static char * GetPath_XDG_RUNTIME_DIR (void)
 
char * GetEnvAlloc (LPCSTR lpName)
 
static char * GetPath_HOME (void)
 
static char * GetPath_TEMP (void)
 
static char * GetPath_XDG_DATA_HOME (void)
 
static char * GetPath_XDG_CACHE_HOME (void)
 
char * GetKnownPath (int id)
 
char * GetKnownSubPath (int id, const char *path)
 
char * GetEnvironmentPath (char *name)
 
char * GetEnvironmentSubPath (char *name, const char *path)
 
char * GetCombinedPath (const char *basePath, const char *subPath)
 
BOOL PathMakePathA (LPCSTR path, LPSECURITY_ATTRIBUTES lpAttributes)
 
BOOL PathMakePathW (LPCWSTR path, LPSECURITY_ATTRIBUTES lpAttributes)
 
BOOL PathIsRelativeA (LPCSTR pszPath)
 
BOOL PathIsRelativeW (LPCWSTR pszPath)
 
BOOL PathFileExistsA (LPCSTR pszPath)
 
BOOL PathFileExistsW (LPCWSTR pszPath)
 
BOOL PathIsDirectoryEmptyA (LPCSTR pszPath)
 
BOOL PathIsDirectoryEmptyW (LPCWSTR pszPath)
 
BOOL winpr_MoveFile (LPCSTR lpExistingFileName, LPCSTR lpNewFileName)
 
BOOL winpr_MoveFileEx (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, DWORD dwFlags)
 
BOOL winpr_DeleteFile (const char *lpFileName)
 
BOOL winpr_RemoveDirectory (LPCSTR lpPathName)
 
BOOL winpr_PathFileExists (const char *pszPath)
 
BOOL winpr_PathMakePath (const char *path, LPSECURITY_ATTRIBUTES lpAttributes)
 

Macro Definition Documentation

◆ TAG

#define TAG   WINPR_TAG("path.shell")

WinPR: Windows Portable Runtime Path Functions

Copyright 2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2016 David PHAM-VAN d.pha.nosp@m.mvan.nosp@m.@inuv.nosp@m.ika..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ GetCombinedPath()

char* GetCombinedPath ( const char *  basePath,
const char *  subPath 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEnvAlloc()

char* GetEnvAlloc ( LPCSTR  lpName)

SHGetKnownFolderPath function: http://msdn.microsoft.com/en-us/library/windows/desktop/bb762188/ XDG Base Directory Specification: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEnvironmentPath()

char* GetEnvironmentPath ( char *  name)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetEnvironmentSubPath()

char* GetEnvironmentSubPath ( char *  name,
const char *  path 
)
Here is the call graph for this function:

◆ GetKnownPath()

char* GetKnownPath ( int  id)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetKnownSubPath()

char* GetKnownSubPath ( int  id,
const char *  path 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPath_HOME()

static char* GetPath_HOME ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPath_TEMP()

static char* GetPath_TEMP ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPath_XDG_CACHE_HOME()

static char* GetPath_XDG_CACHE_HOME ( void  )
static

There is a single base directory relative to which user-specific non-essential (cached) data should be written. This directory is defined by the environment variable $XDG_CACHE_HOME.

$XDG_CACHE_HOME defines the base directory relative to which user specific non-essential data files should be stored. If $XDG_CACHE_HOME is either not set or empty, a default equal to $HOME/.cache should be used.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPath_XDG_CONFIG_HOME()

static char * GetPath_XDG_CONFIG_HOME ( void  )
static

There is a single base directory relative to which user-specific configuration files should be written. This directory is defined by the environment variable $XDG_CONFIG_HOME.

$XDG_CONFIG_HOME defines the base directory relative to which user specific configuration files should be stored. If $XDG_CONFIG_HOME is either not set or empty, a default equal to $HOME/.config should be used.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPath_XDG_DATA_HOME()

static char* GetPath_XDG_DATA_HOME ( void  )
static

There is a single base directory relative to which user-specific data files should be written. This directory is defined by the environment variable $XDG_DATA_HOME.

$XDG_DATA_HOME defines the base directory relative to which user specific data files should be stored. If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPath_XDG_RUNTIME_DIR()

char * GetPath_XDG_RUNTIME_DIR ( void  )
static

There is a single base directory relative to which user-specific runtime files and other file objects should be placed. This directory is defined by the environment variable $XDG_RUNTIME_DIR.

$XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. The directory MUST be owned by the user, and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700.

The lifetime of the directory MUST be bound to the user being logged in. It MUST be created when the user first logs in and if the user fully logs out the directory MUST be removed. If the user logs in more than once he should get pointed to the same directory, and it is mandatory that the directory continues to exist from his first login to his last logout on the system, and not removed in between. Files in the directory MUST not survive reboot or a full logout/login cycle.

The directory MUST be on a local file system and not shared with any other system. The directory MUST by fully-featured by the standards of the operating system. More specifically, on Unix-like operating systems AF_UNIX sockets, symbolic links, hard links, proper permissions, file locking, sparse files, memory mapping, file change notifications, a reliable hard link count must be supported, and no restrictions on the file name character set should be imposed. Files in this directory MAY be subjected to periodic clean-up. To ensure that your files are not removed, they should have their access time timestamp modified at least once every 6 hours of monotonic time or the 'sticky' bit should be set on the file.

If $XDG_RUNTIME_DIR is not set applications should fall back to a replacement directory with similar capabilities and print a warning message. Applications should use this directory for communication and synchronization purposes and should not place larger files in it, since it might reside in runtime memory and cannot necessarily be swapped out to disk.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PathFileExistsA()

BOOL PathFileExistsA ( LPCSTR  pszPath)
Here is the caller graph for this function:

◆ PathFileExistsW()

BOOL PathFileExistsW ( LPCWSTR  pszPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PathIsDirectoryEmptyA()

BOOL PathIsDirectoryEmptyA ( LPCSTR  pszPath)
Here is the caller graph for this function:

◆ PathIsDirectoryEmptyW()

BOOL PathIsDirectoryEmptyW ( LPCWSTR  pszPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PathIsRelativeA()

BOOL PathIsRelativeA ( LPCSTR  pszPath)
Here is the caller graph for this function:

◆ PathIsRelativeW()

BOOL PathIsRelativeW ( LPCWSTR  pszPath)
Here is the call graph for this function:

◆ PathMakePathA()

BOOL PathMakePathA ( LPCSTR  path,
LPSECURITY_ATTRIBUTES  lpAttributes 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PathMakePathW()

BOOL PathMakePathW ( LPCWSTR  path,
LPSECURITY_ATTRIBUTES  lpAttributes 
)
Here is the call graph for this function:

◆ winpr_DeleteFile()

BOOL winpr_DeleteFile ( const char *  lpFileName)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_MoveFile()

BOOL winpr_MoveFile ( LPCSTR  lpExistingFileName,
LPCSTR  lpNewFileName 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_MoveFileEx()

BOOL winpr_MoveFileEx ( LPCSTR  lpExistingFileName,
LPCSTR  lpNewFileName,
DWORD  dwFlags 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_PathFileExists()

BOOL winpr_PathFileExists ( const char *  pszPath)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_PathMakePath()

BOOL winpr_PathMakePath ( const char *  path,
LPSECURITY_ATTRIBUTES  lpAttributes 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ winpr_RemoveDirectory()

BOOL winpr_RemoveDirectory ( LPCSTR  lpPathName)
Here is the call graph for this function:
Here is the caller graph for this function: