ExtractArchive extracts the provided template source archive and modules archive into the working directory. `modulesArchive` is optional and can be nil or empty.
(ctx context.Context, logger slog.Logger, fs afero.Fs, templateSourceArchive, modulesArchive []byte)
| 75 | // ExtractArchive extracts the provided template source archive and modules archive into the working directory. |
| 76 | // `modulesArchive` is optional and can be nil or empty. |
| 77 | func (l Layout) ExtractArchive(ctx context.Context, logger slog.Logger, fs afero.Fs, templateSourceArchive, modulesArchive []byte) error { |
| 78 | err := extractArchive(ctx, logger, fs, l.WorkDirectory(), templateSourceArchive) |
| 79 | if err != nil { |
| 80 | return xerrors.Errorf("extract template source archive: %w", err) |
| 81 | } |
| 82 | |
| 83 | if len(modulesArchive) > 0 { |
| 84 | err = extractArchive(ctx, logger, fs, l.WorkDirectory(), modulesArchive) |
| 85 | if err != nil { |
| 86 | return xerrors.Errorf("extract modules archive: %w", err) |
| 87 | } |
| 88 | } |
| 89 | return nil |
| 90 | } |
| 91 | |
| 92 | func isValidSessionDir(dirName string) bool { |
| 93 | match, err := filepath.Match(sessionDirPrefix+"*", dirName) |