Debian Codegraph @

src/App/ApplicationDirectories.pyi

raw
1 from Base.PyObjectBase import PyObjectBase
2 from typing import List
3
4
5 class ApplicationDirectories(PyObjectBase):
6 """
7 App.ApplicationDirectories class.
8
9 For the time being this class only provides access to the directory versioning methods of its
10 C++ counterpart. These are all static methods, so no instance is needed. The main methods of
11 this class are migrateAllPaths(), usingCurrentVersionConfig(), and versionStringForPath().
12
13 Author: Chris Hennes ([email protected])
14 Licence: LGPL-2.1-or-later
15 DeveloperDocu: ApplicationDirectories
16 """
17
18 @staticmethod
19 def usingCurrentVersionConfig(path:str) -> bool:
20 """
21 usingCurrentVersionConfig(path)
22
23 Determine if a given config path is for the current version of the program
24
25 path : the path to check
26 """
27 ...
28
29 @staticmethod
30 def migrateAllPaths(paths: List[str], /) -> List[str]:
31 """
32 migrateAllPaths(paths)
33
34 Migrate a set of versionable configuration directories from the given paths to a new
35 version. The new version's directories cannot exist yet, and the old ones *must* exist.
36 If the old paths are themselves versioned, then the new paths will be placed at the same
37 level in the directory structure (e.g., they will be siblings of each entry in paths).
38 If paths are NOT versioned, the new (versioned) copies will be placed *inside* the
39 original paths.
40
41 If the list contains the same path multiple times, the duplicates are ignored, so it is safe
42 to pass the same path multiple times.
43
44 Examples:
45 Running FreeCAD 1.1, /usr/share/FreeCAD/Config/ -> /usr/share/FreeCAD/Config/v1-1/
46 Running FreeCAD 1.1, /usr/share/FreeCAD/Config/v1-1 -> raises exception, path exists
47 Running FreeCAD 1.2, /usr/share/FreeCAD/Config/v1-1/ -> /usr/share/FreeCAD/Config/v1-2/
48 """
49 ...
50
51 @staticmethod
52 def versionStringForPath(major:int, minor:int) -> str:
53 """
54 versionStringForPath(major, minor) -> str
55
56 Given a major and minor version number, return a string that can be used as the name for a
57 versioned subdirectory. Only returns the version string, not the full path.
58 """
59 ...
60
61 @staticmethod
62 def isVersionedPath(startingPath:str) -> bool:
63 """
64 isVersionedPath(startingPath) -> bool
65
66 Determine if a given path is versioned (that is, if its last component contains
67 something that this class would have created as a versioned subdirectory). Returns true
68 for any path that the *current* version of FreeCAD would recognized as versioned, and false
69 for either something that is not versioned, or something that is versioned but for a later
70 version of FreeCAD.
71 """
72 ...
73
74 @staticmethod
75 def mostRecentAvailableConfigVersion(startingPath:str) -> str:
76 """
77 mostRecentAvailableConfigVersion(startingPath) -> str
78
79 Given a base path that is expected to contain versioned subdirectories, locate the
80 directory name (*not* the path, only the final component, the version string itself)
81 corresponding to the most recent version of the software, up to and including the current
82 running version, but NOT exceeding it -- any *later* version whose directories exist
83 in the path is ignored. See also mostRecentConfigFromBase().
84 """
85 ...
86
87 @staticmethod
88 def mostRecentConfigFromBase(startingPath: str) -> str:
89 """
90 mostRecentConfigFromBase(startingPath) -> str
91
92 Given a base path that is expected to contained versioned subdirectories, locate the
93 directory corresponding to the most recent version of the software, up to and including
94 the current version, but NOT exceeding it. Returns the complete path, not just the final
95 component. See also mostRecentAvailableConfigVersion().
96 """
97 ...
98
99 @staticmethod
100 def migrateConfig(oldPath: str, newPath: str, /) -> List[str]:
101 """
102 migrateConfig(oldPath, newPath) -> None
103
104 A utility method to copy all files and directories from oldPath to newPath, handling the
105 case where newPath might itself be a subdirectory of oldPath (and *not* attempting that
106 otherwise-recursive copy).
107 """
108 ...