forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatesymlink.cpp
More file actions
41 lines (35 loc) · 871 Bytes
/
Copy pathcreatesymlink.cpp
File metadata and controls
41 lines (35 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! @file createsymlink.cpp
//! @author George FLeming <v-geflem@microsoft.com>
//! @brief create new symbolic link
#include "createsymlink.h"
#include <assert.h>
#include <errno.h>
#include <unistd.h>
#include <string>
//! @brief Createsymlink create new symbolic link
//!
//! Createsymlink
//!
//! @param[in] link
//! @parblock
//! A pointer to the buffer that contains the symbolic link to create
//!
//! char* is marshaled as an LPStr, which on Linux is UTF-8.
//! @endparblock
//!
//! @param[in] target
//! @parblock
//! A pointer to the buffer that contains the existing file
//!
//! char* is marshaled as an LPStr, which on Linux is UTF-8.
//! @endparblock
//!
//! @retval 0 if successful, -1 otherwise
//!
int32_t CreateSymLink(const char *link, const char *target)
{
assert(link);
assert(target);
errno = 0;
return symlink(target, link);
}