1
0
Fork 0

Initial code to separate output files into a directory with a mirrored internal structure.

This commit is contained in:
wael 2021-11-10 12:21:09 +02:00
parent 1294081819
commit 156031d9ab
1 changed files with 8 additions and 2 deletions

View File

@ -1,8 +1,8 @@
#!/bin/zsh
# This script is used to build all the documentation.
# TODO: create options for generating different file types (pdf, html or utf8 to console/file).
# Prompt user at the start for what type they want.
# Specify the output directory's name.
outputdir="pdf_out"
# Specify the file paths, in the order where they should be built.
filepaths=('nodes/single_node.h.ms' 'nodes/double_node.h.ms' 'nodes/tree_node.h.ms' 'strings/strzcpy.ms' 'stack/stack.h.ms' 'linked_lists/double_linked_list.h.ms' 'linked_lists/single_linked_list.h.ms' 'utils/time_function.h.ms' 'trees/binary_tree/binary_tree.h.ms' 'misc_algorithms/search/binary_search.h.ms')
@ -31,12 +31,18 @@ done
# Get the initial root.
root_directory=$(pwd)
# Create a directory to store the PDFs.
mkdir -p $root_directory/
# Loop over the paths: change directory, build, go back up to the root directory.
for i in $filepaths; do
# Get the current directory that we should change into, from the current array variable.
current_directory=$(dirname $i)
cd $current_directory
# Create the current output directory.
# TODO: Finish working on this, needs a way to figure the paths out!
# Get the input and output file names.
input_file=$(basename $i)
output_file=$(echo $input_file | sed "s/ms/$filetype/")