forked from Mirror/libstarlight
I'm not sure if a self-reference here is guaranteed to keep said "self" in scope...?
This commit is contained in:
parent
d64c6034a2
commit
0ee45d7efb
@ -11,6 +11,8 @@ using std::getline;
|
|||||||
|
|
||||||
using starlight::util::Path;
|
using starlight::util::Path;
|
||||||
|
|
||||||
|
string Path::destructed = "";
|
||||||
|
|
||||||
Path::Path(const string& path, bool noverify) {
|
Path::Path(const string& path, bool noverify) {
|
||||||
if (noverify) { strpath = path; return; }
|
if (noverify) { strpath = path; return; }
|
||||||
size_t sls = path.find('/');
|
size_t sls = path.find('/');
|
||||||
@ -24,6 +26,11 @@ Path::Path(const Path& path) {
|
|||||||
strpath = path.strpath; // no need to check here!
|
strpath = path.strpath; // no need to check here!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Path::~Path() {
|
||||||
|
destructed.append(strpath);
|
||||||
|
destructed.append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
Path Path::Up(int levels) {
|
Path Path::Up(int levels) {
|
||||||
if (levels < 1) return *this;
|
if (levels < 1) return *this;
|
||||||
size_t spos = IsDirPath() ? strpath.length() - 1 : string::npos;
|
size_t spos = IsDirPath() ? strpath.length() - 1 : string::npos;
|
||||||
@ -58,3 +65,9 @@ Path Path::Combine(const string& token) {
|
|||||||
}
|
}
|
||||||
return Path(path, true);
|
return Path(path, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Path& Path::CreateDirectory() {
|
||||||
|
// todo: actually create the directory :D
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
@ -13,14 +13,19 @@ namespace starlight {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// vars...
|
// vars...
|
||||||
|
static std::string destructed;
|
||||||
|
|
||||||
Path(const std::string& path, bool noverify = false);
|
Path(const std::string& path, bool noverify = false);
|
||||||
Path(const Path& path);
|
Path(const Path& path);
|
||||||
~Path() = default;
|
~Path();
|
||||||
|
|
||||||
|
// navigation
|
||||||
Path Up(int levels = 1);
|
Path Up(int levels = 1);
|
||||||
Path Combine(const std::string& token);
|
Path Combine(const std::string& token);
|
||||||
|
|
||||||
|
// operation
|
||||||
|
Path& CreateDirectory();
|
||||||
|
|
||||||
// semi-obsolete but whatever, it can stay for now
|
// semi-obsolete but whatever, it can stay for now
|
||||||
inline bool IsDirPath() const { return strpath.back() == '/'; }
|
inline bool IsDirPath() const { return strpath.back() == '/'; }
|
||||||
|
|
||||||
|
@ -71,7 +71,8 @@ void Core::Init() {
|
|||||||
auto pipf = std::make_shared<sl::ui::Label>(VRect(0,0,400,240));
|
auto pipf = std::make_shared<sl::ui::Label>(VRect(0,0,400,240));
|
||||||
pipf->SetFont("default.16"); pipf->borderColor = Color::black;
|
pipf->SetFont("default.16"); pipf->borderColor = Color::black;
|
||||||
//pipf->SetText("I am the very model of something on the top screen. :D\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
|
//pipf->SetText("I am the very model of something on the top screen. :D\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
|
||||||
pipf->SetText(Path("sdmc:/banana/algorithm/").Combine("porcupine/kumquat/romfs:/annual/sdmc:/puffin/pie"));
|
Path("sdmc:/banana/algorithm/").Combine("porcupine/kumquat/romfs:/annual/sdmc:/puffin/pie").CreateDirectory().CreateDirectory().Combine("farticus").Combine("platypus").CreateDirectory().Up();
|
||||||
|
pipf->SetText(Path::destructed);
|
||||||
parallax->Add(pipf);
|
parallax->Add(pipf);
|
||||||
|
|
||||||
clearColor = Color(0.0f, 0.5f, 0.5f);
|
clearColor = Color(0.0f, 0.5f, 0.5f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user