Commit d64fa68d2437299a00cfbd2e91121570a493e55f
1 parent
f4069d3f
implemented raw saving for matrices, fixed a root-directory bug in stim::filename
Showing
2 changed files
with
12 additions
and
1 deletions
Show diff stats
stim/math/matrix.h
... | ... | @@ -435,6 +435,14 @@ public: |
435 | 435 | } |
436 | 436 | } |
437 | 437 | |
438 | + void raw(std::string filename) { | |
439 | + ofstream out(filename, std::ios::binary); | |
440 | + if (out) { | |
441 | + out.write((char*)data(), rows() * cols() * sizeof(T)); | |
442 | + out.close(); | |
443 | + } | |
444 | + } | |
445 | + | |
438 | 446 | void mat4(stim::mat4file& file, std::string name = std::string("unknown"), mat4Format format = mat4_float) { |
439 | 447 | //make sure the matrix name is valid (only numbers and letters, with a letter at the beginning |
440 | 448 | for (size_t c = 0; c < name.size(); c++) { | ... | ... |
stim/parser/filename.h
... | ... | @@ -89,8 +89,11 @@ protected: |
89 | 89 | absolute.push_back(relative[i]); |
90 | 90 | } |
91 | 91 | } |
92 | - else | |
92 | + else { | |
93 | + if (relative[0] == ".") | |
94 | + relative = std::vector<std::string>(relative.begin() + 1, relative.end()); | |
93 | 95 | absolute = relative; |
96 | + } | |
94 | 97 | } |
95 | 98 | |
96 | 99 | /// Parses a directory string into a drive (NULL if not Windows) and list of hierarchical directories | ... | ... |