Skip to content

Commit

Permalink
Remove file extensions for headers (#13)
Browse files Browse the repository at this point in the history
- Remove file extensions for headers
- Add github linguist support
  • Loading branch information
bugdea1er authored Feb 2, 2024
1 parent 3b1a15d commit 6e9a1f1
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include/tmp/* linguist-language=C++
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Currently only works on UNIX-like systems because it uses functions similar to m
tmp::directory is a smart handle that owns and manages a temporary directory and deletes it recursively when this handle goes out of scope. This can be useful for setting up a directory to later use as a PWD for some process. For example,

```cpp
#include <tmp/directory>
...
auto tmpdir = tmp::directory("org.example.product");
fs::copy(file, tmpdir);

Expand All @@ -26,6 +28,8 @@ auto output = tmpdir / "output_file.txt";
tmp::file, on the other hand, is a smart handle for a temporary file. It is also deleted if the handle goes out of scope. This can be useful, for example, for accepting a file from a socket and testing it before saving in a long-term storage:
```cpp
#include <tmp/file>
...
auto tmpfile = tmp::file("org.example.product");
tmpfile.write(data);
Expand Down
4 changes: 2 additions & 2 deletions include/tmp/directory.hpp → include/tmp/directory
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <tmp/path.hpp>
#include <tmp/path>

#include <filesystem>
#include <string_view>
Expand All @@ -25,7 +25,7 @@ namespace tmp {
/// deleted along with all of its contents:
///
/// @code{.cpp}
/// #include <tmp/directory.hpp>
/// #include <tmp/directory>
///
/// auto func() {
/// auto tmpdir = tmp::directory("org.example.product");
Expand Down
4 changes: 2 additions & 2 deletions include/tmp/file.hpp → include/tmp/file
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <tmp/path.hpp>
#include <tmp/path>

#include <filesystem>
#include <string_view>
Expand All @@ -27,7 +27,7 @@ namespace tmp {
/// goes out of scope and the temporary file:
///
/// @code{.cpp}
/// #include <tmp/file.hpp>
/// #include <tmp/file>
///
/// auto func(std::string_view content) {
/// auto tmpfile = tmp::file("org.example.product");
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/directory.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <tmp/directory.hpp>
#include <tmp/directory>

#include <filesystem>
#include <string_view>
Expand Down
2 changes: 1 addition & 1 deletion lib/file.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <tmp/file.hpp>
#include <tmp/file>

#include <cstdlib>
#include <filesystem>
Expand Down
2 changes: 1 addition & 1 deletion lib/path.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <tmp/path.hpp>
#include <tmp/path>

#include <filesystem>
#include <system_error>
Expand Down
2 changes: 1 addition & 1 deletion tests/directory_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <tmp/directory.hpp>
#include <tmp/directory>

#include <gtest/gtest.h>

Expand Down
2 changes: 1 addition & 1 deletion tests/file_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <tmp/file.hpp>
#include <tmp/file>

#include <gtest/gtest.h>
#include <fstream>
Expand Down

0 comments on commit 6e9a1f1

Please sign in to comment.