* Create a new file in the given set. */
| 151 | * Create a new file in the given set. |
| 152 | */ |
| 153 | File |
| 154 | SharedFileSetCreate(SharedFileSet *fileset, const char *name) |
| 155 | { |
| 156 | char path[MAXPGPATH]; |
| 157 | File file; |
| 158 | |
| 159 | SharedFilePath(path, fileset, name); |
| 160 | file = PathNameCreateTemporaryFile(path, false); |
| 161 | |
| 162 | /* If we failed, see if we need to create the directory on demand. */ |
| 163 | if (file <= 0) |
| 164 | { |
| 165 | char tempdirpath[MAXPGPATH]; |
| 166 | char filesetpath[MAXPGPATH]; |
| 167 | Oid tablespace = ChooseTablespace(fileset, name); |
| 168 | |
| 169 | TempTablespacePath(tempdirpath, tablespace); |
| 170 | SharedFileSetPath(filesetpath, fileset, tablespace); |
| 171 | PathNameCreateTemporaryDir(tempdirpath, filesetpath); |
| 172 | file = PathNameCreateTemporaryFile(path, true); |
| 173 | } |
| 174 | |
| 175 | return file; |
| 176 | } |
| 177 | |
| 178 | /* |
| 179 | * Open a file that was created with SharedFileSetCreate(), possibly in |
no test coverage detected