direcs  2012-09-30
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
joyreaderMacOS-objc.m
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright (C) Markus Knapp *
3  * www.direcs.de *
4  * *
5  * This file is part of direcs. *
6  * *
7  * direcs is free software: you can redistribute it and/or modify it *
8  * under the terms of the GNU General Public License as published *
9  * by the Free Software Foundation, version 3 of the License. *
10  * *
11  * direcs is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with direcs. If not, see <http://www.gnu.org/licenses/>. *
18  * *
19  *************************************************************************/
20 
21 #include <stdio.h>
22 #import <Cocoa/Cocoa.h>
23 #import <Foundation/NSPathUtilities.h> /* -framework Foundation */
24 
25 FILE *JoyReaderOpenJoystickCalibrationFileC(const char mode[])
26 {
27  FILE *fp;
28 
29  NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init];
30  NSString *homeDir;
31  NSString *cwd;
32 
33  homeDir=NSHomeDirectory(); // Do I release the string?
34  cwd=[[NSFileManager defaultManager] currentDirectoryPath];
35 
36  [[NSFileManager defaultManager] changeCurrentDirectoryPath:homeDir];
37 
38  fp=fopen(".ysjoycalib",mode);
39 
40  [[NSFileManager defaultManager] changeCurrentDirectoryPath:cwd];
41 
42  [pool release];
43 
44  return fp;
45 }