• Stars
    star
    795
  • Rank 57,274 (Top 2 %)
  • Language
    C
  • License
    Other
  • Created almost 12 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lightweight, portable and easy to integrate C directory and file reader

TinyDir

CMake Release

Lightweight, portable and easy to integrate C directory and file reader. TinyDir wraps dirent for POSIX and FindFirstFile for Windows.

Windows unicode is supported by defining UNICODE and _UNICODE before including tinydir.h.

Example

There are two methods. Error checking omitted:

tinydir_dir dir;
tinydir_open(&dir, "/path/to/dir");

while (dir.has_next)
{
	tinydir_file file;
	tinydir_readfile(&dir, &file);

	printf("%s", file.name);
	if (file.is_dir)
	{
		printf("/");
	}
	printf("\n");

	tinydir_next(&dir);
}

tinydir_close(&dir);
tinydir_dir dir;
int i;
tinydir_open_sorted(&dir, "/path/to/dir");

for (i = 0; i < dir.n_files; i++)
{
	tinydir_file file;
	tinydir_readfile_n(&dir, &file, i);

	printf("%s", file.name);
	if (file.is_dir)
	{
		printf("/");
	}
	printf("\n");
}

tinydir_close(&dir);

See the /samples folder for more examples, including an interactive command-line directory navigator.

Language

ANSI C, or C90.

Platforms

POSIX and Windows supported. Open to the possibility of supporting other platforms.

License

Simplified BSD; if you use tinydir you can comply by including tinydir.h or COPYING somewhere in your package.

Known Limitations

More Repositories

1

cdogs-sdl

Classic overhead run-and-gun game
C
887
star
2

DrunkenViking

Top-down puzzle game for Mini LD 53
JavaScript
59
star
3

gomapgen

A 2d map generator written in Go
Go
41
star
4

PepperTown

🧙 RPG-themed idle game
JavaScript
38
star
5

MagusPreservation

Information about the obscure roguelike, Magus
HTML
28
star
6

Beatrix

Low-rez music HTML5 game for LOWREZ jam 2014
JavaScript
17
star
7

TinyGunGen

🔫 Randomly generate pixel gun icons
MoonScript
15
star
8

SDL_JoystickButtonNames

A small library to get joystick button names and colors, to be used with SDL2
C
14
star
9

Dunkman

🏀A minigame of slam dunk for TIC-80
MoonScript
13
star
10

find_steam_game

Header-only cross platform C library for finding games installed from platforms like steam
C
10
star
11

Slappa

Arcade minigame made in pygame, for PyWeek https://pyweek.org/19/
Python
9
star
12

GrowQuickly

👩‍🌾 An arcade farming game
Lua
9
star
13

ENetLANChatServer

A simple LAN chat server/client using ENet
C
9
star
14

tic-80-examples

Code examples for the TIC-80 fantasy console
MoonScript
5
star
15

where-to-live

Python script for finding an ideal suburb to live in
Python
5
star
16

sdl2-9-slice

Demo program of performing 9-slice scale rendering with SDL2
CMake
5
star
17

pykwalify-webform

Generate webforms based on YAML schema with pykwalify
JavaScript
5
star
18

LoveTiledMap

Tiled map implementation for Love 2D, based on https://love2d.org/wiki/TiledMapLoader
Lua
5
star
19

BlueAlert

1D de-make of a modern RTS for Mini LD 50
JavaScript
4
star
20

sdl2-rendercopyex-demo

Demonstrate stuff you can do with SDL2's SDL_RenderCopyEx()
CMake
4
star
21

CyberdogsNameGen

Random name generator for Cyberdogs and C-Dogs
C
4
star
22

cwolfmap

Wolf 3D map reader in C
C++
4
star
23

cxong.github.io

Personal game dev blog
HTML
4
star
24

RonnyWesterPics

Decoder for graphics files in Ronny Wester games
C
3
star
25

wibblish

Gibberish speech generator toy
JavaScript
3
star
26

jonga

Physics based kung fu boss battle game for mini LD 62
JavaScript
3
star
27

sdl-image-1.2-test

Sample program for displaying an image in a window using SDL Image 1.2, configured with CMake
Objective-C
2
star
28

Granny-s-House

👵A simple demo showcasing sprites made for a game jam🐈‍⬛
HTML
2
star
29

LassoLassie

Old school shooting game for Wild West Jam
JavaScript
2
star
30

Taiketsu

Versus shmup for 2014 Spring GDSE Gamejam
JavaScript
2
star
31

sdl2-image-test

Sample program for displaying an image in a window using SDL2 Image, configured with CMake
CMake
2
star
32

coconuts

A rhythm game for LD 33
JavaScript
2
star
33

cxong

MoonScript
1
star
34

sdl2-maprgb-test

Test conversion of RGB to pixel value
CMake
1
star
35

sdl2-blendmodes

A demo of using SDL2's texture blend modes
CMake
1
star
36

CyberAssassin

A game made for Cyberpunk Game Jam 2014
JavaScript
1
star
37

tic80-cart-scraper

Script to scrape, download and extract metadata from carts hosted on the TIC-80 website
Python
1
star
38

hectic-panda

JavaScript
1
star
39

QuestTown

Rust
1
star
40

nuklear_cmake_demo

Demo C GUI project using nuklear/SDL2/OpenGL2/CMake
C
1
star
41

tic80-draw-image

Demo of how to draw an arbitrary image in TIC-80
Lua
1
star
42

FoxyStars3js

Experiments in three.js
JavaScript
1
star
43

RADPlayer

Example player for RAD 2 tracker files
C++
1
star
44

RonnysMagus

Port of Ronny Wester's roguelike, Magus, to SDL
C
1
star