VirtualBox

source: vbox/trunk/src/VBox/GuestHost/DragAndDrop/DnDPath.cpp@ 58312

Last change on this file since 58312 was 57372, checked in by vboxsync, 9 years ago

scm: fixes in previous cleanup run.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1/* $Id: DnDPath.cpp 57372 2015-08-14 22:01:25Z vboxsync $ */
2/** @file
3 * DnD: Path handling.
4 */
5
6/*
7 * Copyright (C) 2014 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*********************************************************************************************************************************
20* Header Files *
21*********************************************************************************************************************************/
22
23#include <iprt/path.h>
24#include <iprt/string.h>
25
26#include <VBox/GuestHost/DragAndDrop.h>
27
28/**
29 * Sanitizes the file name component so that unsupported characters
30 * will be replaced by an underscore ("_").
31 *
32 * @return IPRT status code.
33 * @param pszPath Path to sanitize.
34 * @param cbPath Size (in bytes) of path to sanitize.
35 */
36int DnDPathSanitizeFilename(char *pszPath, size_t cbPath)
37{
38 int rc = VINF_SUCCESS;
39#ifdef RT_OS_WINDOWS
40 /* Filter out characters not allowed on Windows platforms, put in by
41 RTTimeSpecToString(). */
42 /** @todo Use something like RTPathSanitize() when available. Later. */
43 RTUNICP aCpSet[] =
44 { ' ', ' ', '(', ')', '-', '.', '0', '9', 'A', 'Z', 'a', 'z', '_', '_',
45 0xa0, 0xd7af, '\0' };
46 ssize_t cReplaced = RTStrPurgeComplementSet(pszPath, aCpSet, '_' /* Replacement */);
47 if (cReplaced < 0)
48 rc = VERR_INVALID_UTF8_ENCODING;
49#endif
50 return rc;
51}
52
53int DnDPathSanitize(char *pszPath, size_t cbPath)
54{
55 /** @todo */
56 return VINF_SUCCESS;
57}
58
Note: See TracBrowser for help on using the repository browser.

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