Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/qt_gui/src/lib/util/file.cc @ 7615

Last change on this file since 7615 was 7615, checked in by bensch, 19 years ago

orxonox/qt_gui: file works… till now

File size: 2.4 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16#include "file.h"
17
18#include <sys/types.h>
19#include <sys/stat.h>
20
21#ifdef __unix__
22#include <unistd.h>
23#elif __WIN32__ || _MS_DOS_
24#include <dir.h>
25#else
26#include <direct.h>
27#endif
28
29
30
31File::File()
32{
33#warning implement
34}
35
36File::File(const std::string& fileName)
37{
38#warning implement
39}
40
41File::File(const File& file)
42{
43#warning implement
44}
45
46File::~File()
47{
48#warning implement
49}
50
51bool File::open(OpenMode mode)
52{
53#warning implement
54}
55
56bool File::close()
57{
58#warning implement
59}
60
61int File::handle()
62{
63#warning implement
64}
65
66bool File::exists()
67{
68#warning implement
69}
70
71bool File::isLink()
72{
73#warning implement
74}
75// only on UNIX
76bool File::isFile()
77{
78#warning implement
79}
80
81bool File::isDirectory()
82{
83  std::string tmpDirName = this->_name;
84  struct stat status;
85
86  // checking for the termination of the string given. If there is a "/" at the end cut it away
87  if (this->_name[this->_name.size()-1] == '/' ||
88      this->_name[this->_name.size()-1] == '\\')
89  {
90    tmpDirName.erase(tmpDirName.size()-1);
91  }
92
93  if(!stat(tmpDirName.c_str(), &status))
94  {
95    if (status.st_mode & (S_IFDIR
96#ifndef __WIN32__
97        | S_IFLNK
98#endif
99                         ))
100    {
101      return true;
102    }
103    else
104      return false;
105  }
106  else
107    return false;
108}
109
110bool File::isReadeable()
111{
112
113#warning implement
114}
115
116bool File::isWriteable()
117{
118#warning implement
119}
120bool File::isExecutable()
121{
122#warning implement
123}
124
125
126bool File::copy(const File& destination)
127{
128#warning implement
129}
130bool File::rename(const File& destination)
131{
132#warning implement
133}
134bool File::touch()
135{
136#warning implement
137}
138bool File::remove()
139{
140#warning implement
141}
142
143void File::relToAbs(std::string& fileName)
144{
145#warning implement
146}
147void File::absToRel(std::string& fileName)
148{
149#warning implement
150}
151
152
153
154
155std::string File::_cwd = "";
156
157/**
158 * @returns the Current Woring Directory
159 */
160const std::string& File::cwd()
161{
162  if (File::_cwd.empty())
163  {
164    char cwd[1024];
165    char* errorCode = getcwd(cwd, 1024);
166    if (errorCode == 0)
167      return File::_cwd;
168
169    File::_cwd = cwd;
170  }
171  return File::_cwd;
172}
173
174
175
176#include "file.h"
177
178
Note: See TracBrowser for help on using the repository browser.