Jypeli 10
The simple game programming library
FileManager.cs
Siirry tämän tiedoston dokumentaatioon.
1// unset
2
3using System;
4using System.IO;
5
6namespace Jypeli
7{
8 public partial class FileManager
9 {
10 protected string[] pathCandidates;
11
12 public FileManager( params string[] pathCandidates )
13 {
14 this.pathCandidates = pathCandidates;
15 }
16
17 protected void Initialize()
18 {
19 if ( _currentDir != null )
20 return;
21
22 for ( int i = 0; i < pathCandidates.Length; i++ )
23 {
25
26 if ( Directory.Exists( _currentDir ) )
27 return;
28 else
29 {
30 var parent = Directory.GetParent( _currentDir );
31 if ( !parent.Exists ) continue;
32 Directory.CreateDirectory( _currentDir );
33 }
34 }
35 }
36 }
37
41 public static class FileLocation
42 {
46 public static readonly string MyDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
47
51 public static readonly string MyMusic = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);
52
56 public static readonly string MyPictures = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
57
61 public static readonly string MyVideos = Environment.GetFolderPath(Environment.SpecialFolder.MyVideos);
62
66 public static readonly string ExePath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
67
71 public static readonly string DataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data");
72
76 public static readonly string ContentPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content");
77 }
78}
Usein käytettyjä polkuja Windowsissa.
Definition: FileManager.cs:42
static readonly string MyDocuments
Omat tiedostot.
Definition: FileManager.cs:46
static readonly string DataPath
Ohjelman data-alihakemisto.
Definition: FileManager.cs:71
static readonly string ExePath
Ohjelman hakemisto.
Definition: FileManager.cs:66
static readonly string ContentPath
Ohjelman content-alihakemisto.
Definition: FileManager.cs:76
static readonly string MyVideos
Omat videot.
Definition: FileManager.cs:61
static readonly string MyPictures
Omat kuvatiedostot.
Definition: FileManager.cs:56
static readonly string MyMusic
Oma musiikki.
Definition: FileManager.cs:51
FileManager(params string[] pathCandidates)
Definition: FileManager.cs:12
string[] pathCandidates
Definition: FileManager.cs:10