Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

first function

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#ifdef __unix__
19#include <unistd.h>
20#elif __WIN32__ || _MS_DOS_
21#include <dir.h>
22#else
23#include <direct.h>
24#endif
25
26
27
28File::File()
29{
30#warning implement
31}
32
33File::File(const std::string& fileName)
34{
35#warning implement
36}
37
38File::File(const File& file)
39{
40#warning implement
41}
42
43File::~File()
44{
45#warning implement
46}
47
48bool File::open(OpenMode mode)
49{
50#warning implement
51}
52bool File::close()
53{
54#warning implement
55}
56int File::handle()
57{
58#warning implement
59}
60
61bool File::exists()
62{
63#warning implement
64}
65bool File::isLink()
66{
67#warning implement
68}      // only on UNIX
69bool File::isFile()
70{
71#warning implement
72}
73bool File::isDirectory()
74{
75  std::string tmpDirName = this->_name;
76  struct stat status;
77
78  // checking for the termination of the string given. If there is a "/" at the end cut it away
79  if (directoryName[directoryName.size()-1] == '/' ||
80      directoryName[directoryName.size()-1] == '\\')
81  {
82    tmpDirName.erase(tmpDirName.size()-1);
83  }
84
85  if(!stat(tmpDirName.c_str(), &status))
86  {
87    if (status.st_mode & (S_IFDIR
88#ifndef __WIN32__
89        | S_IFLNK
90#endif
91                         ))
92    {
93      return true;
94    }
95    else
96      return false;
97  }
98  else
99    return false;
100}
101
102bool File::isReadeable()
103{
104
105#warning implement
106}
107
108bool File::isWriteable()
109{
110#warning implement
111}
112bool File::isExecutable()
113{
114#warning implement
115}
116
117
118bool File::copy(const File& destination)
119{
120#warning implement
121}
122bool File::rename(const File& destination)
123{
124#warning implement
125}
126bool File::touch()
127{
128#warning implement
129}
130bool File::remove()
131{
132#warning implement
133}
134
135void File::relToAbs(std::string& fileName)
136{
137#warning implement
138}
139void File::absToRel(std::string& fileName)
140{
141#warning implement
142}
143
144
145
146
147std::string File::_cwd = "";
148
149/**
150 * @returns the Current Woring Directory
151 */
152const std::string& File::cwd()
153{
154  if (File::_cwd.empty())
155  {
156    char cwd[1024];
157    char* errorCode = getcwd(cwd, 1024);
158    if (errorCode == 0)
159      return File::_cwd;
160
161    File::_cwd = cwd;
162  }
163  return File::_cwd;
164}
165
166
167
168#include "file.h"
169
170
Note: See TracBrowser for help on using the repository browser.