------------------------------------------------------------------------------ This function sets the name of the file.
| 154 | //------------------------------------------------------------------------------ |
| 155 | // This function sets the name of the file. |
| 156 | void vtkImageReader2::SetFileName(const char* name) |
| 157 | { |
| 158 | if (this->FileName && name && (!strcmp(this->FileName, name))) |
| 159 | { |
| 160 | return; |
| 161 | } |
| 162 | if (!name && !this->FileName) |
| 163 | { |
| 164 | return; |
| 165 | } |
| 166 | delete[] this->FileName; |
| 167 | this->FileName = nullptr; |
| 168 | if (name) |
| 169 | { |
| 170 | this->FileName = new char[strlen(name) + 1]; |
| 171 | strcpy(this->FileName, name); |
| 172 | |
| 173 | delete[] this->FilePrefix; |
| 174 | this->FilePrefix = nullptr; |
| 175 | if (this->FileNames) |
| 176 | { |
| 177 | this->FileNames->Delete(); |
| 178 | this->FileNames = nullptr; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | this->Modified(); |
| 183 | } |
| 184 | |
| 185 | //------------------------------------------------------------------------------ |
| 186 | // This function sets an array containing file names |