summaryrefslogtreecommitdiffstats
path: root/win/kde_file_win.h
blob: 0f32d26637742f90e43a24166fb3d2945177e65d (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
   This file is part of the KDE libraries
   Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef KDE_FILE_WIN_H
#define KDE_FILE_WIN_H

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <fcntl.h>
#include <ctype.h>

#include <tdecore/tdelibs_export.h> 

#ifdef __cplusplus
extern "C" {
#endif

/**
 Works like ::stat() but also:
  1) if @path is like "C:", '\' is appended
  2) else, '/' or '\' trailing characters are removed from @file_name
 */
KDEWIN32_EXPORT int kdewin32_stat(const char *file_name, struct stat *buf);

/**
 Identical to kdewin32_stat()
 */
KDEWIN32_EXPORT int kdewin32_lstat(const char *file_name, struct stat *buf);

/**
 Works like ::open() but also:
  - if @flags have not specified O_TEXT flag, O_BINARY flag is appended
    (because on win32 O_TEXT mode is the default, not O_BINARY like on unix)
 */
KDEWIN32_EXPORT int kdewin32_open(const char *path, int flags, ... /*mode_t mode*/);

/*KDEWIN32_EXPORT int kdewin32_open(const char *path, int flags);*/

/**
 Works like ::fopen() but also:
  - if @mode have specified neither "t" (text flag) or "b" (binary flag), 
    "b" (binary) flag is appended (or inserted before '+' character)
    (because on win32 text mode is the default, not binary like on unix)
 */
KDEWIN32_EXPORT FILE *kdewin32_fopen(const char *path, const char *mode);

KDEWIN32_EXPORT FILE *kdewin32_fdopen(int fd, const char *mode);

KDEWIN32_EXPORT FILE *kdewin32_freopen(const char *path, const char *mode, FILE *stream);

/**
 Before calling ::rename(), tries to remove() it, is needed, 
 because win32 semantics doesn't allow files overwriting using ::rename().
*/
KDEWIN32_EXPORT int kdewin32_rename(const char *src, const char *dest);

/**
 A wrapped for ::mkdir() used by KDE_mkdir().
*/
KDEWIN32_EXPORT int kdewin32_mkdir(const char *path, mode_t mode);

#ifdef __cplusplus
}
#endif

#endif //KDE_FILE_WIN_H