[tests] Don't assume CWD is writable
[mono.git] / mcs / class / Mono.Posix / Test / Mono.Unix / StdioFileStreamTest.cs
index 1b6e2f3017ec725366d0fad411d4fbaa068d90c1..23e26ea05cb91847b072a734cb21a369b52829f8 100644 (file)
@@ -226,21 +226,22 @@ namespace MonoTests.System.IO
                {
                        StdioFileStream fs = null;
                        StdioFileStream fs2 = null;
+                       string tempPath = Path.Combine (Path.GetTempPath (), "temp");
                        try {
-                               if (!File.Exists ("temp")) {
-                                       TextWriter tw = File.CreateText ("temp");
+                               if (!File.Exists (tempPath)) {
+                                       TextWriter tw = File.CreateText (tempPath);
                                        tw.Write ("FOO");
                                        tw.Close ();
                                }
-                               fs = new StdioFileStream ("temp", FileMode.Open, FileAccess.Read);
-                               fs2 = new StdioFileStream ("temp", FileMode.Open, FileAccess.Read);
+                               fs = new StdioFileStream (tempPath, FileMode.Open, FileAccess.Read);
+                               fs2 = new StdioFileStream (tempPath, FileMode.Open, FileAccess.Read);
                        } finally {
                                if (fs != null)
                                        fs.Close ();
                                if (fs2 != null)
                                        fs2.Close ();
-                               if (File.Exists ("temp"))
-                                       File.Delete ("temp");
+                               if (File.Exists (tempPath))
+                                       File.Delete (tempPath);
                        }
                }
 
@@ -500,7 +501,7 @@ namespace MonoTests.System.IO
                [Test]
                public void TestClose ()
                {
-#if FUCK
+#if FALSE
                        string path = TempFolder + Path.DirectorySeparatorChar + "TestClose";
                        DeleteFile (path);