Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 16 additions & 30 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,28 @@ name: Build Check
on:
pull_request:
permissions:
contents: write
contents: read
jobs:
build:
strategy:
matrix:
platform: [
{name: "Linux Debug", os: "ubuntu-22.04", ext: "tar.gz", config: "Debug"},
{name: "Linux Release", os: "ubuntu-24.04", ext: "tar.gz", config: "Release"},
{name: "Windows Debug", os: "windows-2022", ext: "zip", config: "Debug"},
{name: "Windows Release", os: "windows-2022", ext: "zip", config: "Release"},
{name: "macOS Debug", os: "macos-15", ext: "tar.gz", config: "Debug"},
{name: "macOS Release", os: "macos-15", ext: "tar.gz", config: "Release"}
{name: "Linux Debug", os: "ubuntu-22.04", config: "Debug"},
{name: "Linux Release", os: "ubuntu-24.04", config: "Release"},
{name: "Windows Debug", os: "windows-2022", config: "Debug"},
{name: "Windows Release", os: "windows-2022", config: "Release"},
{name: "macOS Debug", os: "macos-15", config: "Debug"},
{name: "macOS Release", os: "macos-15", config: "Release"}
]
runs-on: ${{ matrix.platform.os }}
name: ${{ matrix.platform.name }}
steps:
- uses: actions/checkout@v4
- name: Install macOS deps
if: runner.os == 'macOS'
run: brew install llvm
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.platform.config }}
- name: Build
working-directory: ./build
run: cmake --build . --config ${{ matrix.platform.config }}
- name: Package
shell: bash
run: |
mkdir -p build/install
cmake --install build --config ${{ matrix.platform.config }} --prefix build/install
cd build/install
if [ "${{ matrix.platform.ext }}" = "zip" ]; then
7z a ../../fsminit-${{ matrix.platform.config }}-${{ matrix.platform.os }}.${{ matrix.platform.ext }} *
else
tar -czf ../../fsminit-${{ matrix.platform.config }}-${{ matrix.platform.os }}.${{ matrix.platform.ext }} .
fi
- uses: softprops/action-gh-release@v2
with:
files: fsminit-${{ matrix.platform.config }}-${{ matrix.platform.os }}.*
- uses: actions/checkout@v4
- name: Install macOS deps
if: runner.os == 'macOS'
run: brew install llvm
- name: Configure
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.platform.config }}
- name: Build
working-directory: ./build
run: cmake --build . --config ${{ matrix.platform.config }}
56 changes: 56 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Build directories
build/
bin/
out/
cmake-build-*/

# CMake
CMakeFiles/
CMakeCache.txt
cmake_install.cmake
Makefile
compile_commands.json

# IDE / editor
.vscode/
.idea/
*.swp
*~

# Tests
tests/
16 changes: 13 additions & 3 deletions include/def_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include <stddef.h>
#include <stdbool.h>

#ifndef PATH_MAX
#define PATH_MAX 4096
#endif

/* =======================
CLI Option Structure
======================= */
Expand Down Expand Up @@ -107,9 +111,15 @@ typedef struct FS_TABLES
const char *name;
} FS_TABLES;

/* =======================
External Declarations
======================= */
typedef struct TABLE_FILE_LIST
{
char **paths;
size_t count;
} TABLE_FILE_LIST;

/* =======================
External Declarations
======================= */
extern const char *voice_subdirs[];
extern const size_t voice_subdirs_count;

Expand Down
3 changes: 2 additions & 1 deletion include/file_subsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ void create_directories(OP *operation);
void create_tbl_tables(OP *operation);
void create_tbm_tables(OP *operation);
void create_static_tables(OP *operation);
bool check_if_mod_structure_exists(const char *base_path);
bool check_if_mod_structure_exists(const char *base_path);
bool path_is_dir(const char *path);
3 changes: 1 addition & 2 deletions src/file_subsystem.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* file_subsystem.c */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Expand Down Expand Up @@ -147,7 +146,7 @@ const size_t static_tables_count = 1;
File & Directory Creation
===================================== */

static bool path_is_dir(const char *path)
bool path_is_dir(const char *path)
{
struct stat st;
if (stat(path, &st) != 0)
Expand Down
39 changes: 33 additions & 6 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
/* main.c */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h> // for va_list / va_start / va_end
#include <stdbool.h>
#include <limits.h>

#ifdef _WIN32
#include <io.h>
#include <windows.h>

#define isatty _isatty

// Windows asprintf wrapper
#define asprintf(buf, fmt, ...) _asprintf(buf, fmt, __VA_ARGS__)
static int _asprintf(char **ret, const char *format, ...)
{
va_list ap;
int size;
va_start(ap, format);
size = vsnprintf(NULL, 0, format, ap);
va_end(ap);
if (size < 0)
return -1;
*ret = malloc(size + 1);
if (!*ret)
return -1;
va_start(ap, format);
size = vsnprintf(*ret, size + 1, format, ap);
va_end(ap);
return size;
}

#else
#include <unistd.h>
#endif

#ifndef PATH_MAX
#define PATH_MAX 4096
#endif

#include "version.h"
#include "def_type.h"
#include "file_subsystem.h"
Expand Down Expand Up @@ -91,7 +109,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "%s%sUsage:%s -stdm <path> [-debug] [-dry-run]\n",
TEX_BOLD, COL_YELLOW, COL_RESET);
else
fprintf(stderr, "%s%sUsage:%s -stdmc <path> <-tbl/-tbm> [prefix] [-debug] [-dry-run]\n",
fprintf(stderr, "%s%sUsage:%s -stdmc <path> <-tbl/-tbm> [prefix] [-bpl] [-debug] [-dry-run]\n",
TEX_BOLD, COL_YELLOW, COL_RESET);
return 1;
}
Expand Down Expand Up @@ -123,9 +141,18 @@ int main(int argc, char *argv[])
for (int i = start_index; i < argc; ++i)
{
if (strcmp(argv[i], "-debug") == 0)
{
operation.debug = 1;
}
else if (strcmp(argv[i], "-dry-run") == 0)
{
operation.dry_run = 1;
}
else
{
fprintf(stderr, "Unknown argument: %s\n", argv[i]);
return 1;
}
}

if (operation.debug)
Expand Down
Loading