diff --git a/qml/GraphView.qml b/qml/GraphView.qml index 193950d..98e92d9 100644 --- a/qml/GraphView.qml +++ b/qml/GraphView.qml @@ -55,8 +55,8 @@ Item { ctx.lineWidth = 2 // Edge drawing would use model.getTransitions() - // Draw all nodes (no arbitrary limit) - var maxNodesToShow = Math.min(nodeCount, 100) // Reasonable limit for performance + // Draw nodes (limit to 100 for performance) + var maxNodesToShow = Math.min(nodeCount, 100) for (var i = 0; i < maxNodesToShow; i++) { var angle = (i / nodeCount) * 2 * Math.PI var x = centerX + radius * Math.cos(angle) diff --git a/src/github_importer.cpp b/src/github_importer.cpp index 1637262..99a874a 100644 --- a/src/github_importer.cpp +++ b/src/github_importer.cpp @@ -23,19 +23,34 @@ public: Impl() { curl = curl_easy_init(); // Create cache directory - prefer user-specific cache location + // Fallback to a subdirectory in temp if user directories unavailable #ifdef _WIN32 const char* appdata = std::getenv("APPDATA"); if (appdata) { cache_dir = std::string(appdata) + "/tla_visualiser/cache"; } else { - cache_dir = std::filesystem::temp_directory_path() / "tla_visualiser_cache"; + // Windows fallback: use ProgramData or temp with warning + const char* programdata = std::getenv("ProgramData"); + if (programdata) { + cache_dir = std::string(programdata) + "/tla_visualiser/cache"; + } else { + cache_dir = std::filesystem::temp_directory_path() / "tla_visualiser_cache"; + std::cerr << "Warning: Using temp directory for cache. Consider setting APPDATA." << std::endl; + } } #else const char* home = std::getenv("HOME"); if (home) { cache_dir = std::string(home) + "/.cache/tla_visualiser"; } else { - cache_dir = std::filesystem::temp_directory_path() / "tla_visualiser_cache"; + // Unix fallback: try XDG or temp with warning + const char* xdg_cache = std::getenv("XDG_CACHE_HOME"); + if (xdg_cache) { + cache_dir = std::string(xdg_cache) + "/tla_visualiser"; + } else { + cache_dir = std::filesystem::temp_directory_path() / "tla_visualiser_cache"; + std::cerr << "Warning: Using temp directory for cache. Consider setting HOME or XDG_CACHE_HOME." << std::endl; + } } #endif std::filesystem::create_directories(cache_dir); diff --git a/src/trace_viewer_model.cpp b/src/trace_viewer_model.cpp index 54ab330..23c15df 100644 --- a/src/trace_viewer_model.cpp +++ b/src/trace_viewer_model.cpp @@ -94,7 +94,8 @@ void TraceViewerModel::loadTrace(const TLCRunner::CounterExample& trace, step.variables = it->variables; // Find action (transition to this state) - if (step_num > 0) { // Fixed: check before increment + // Only non-initial steps have transitions + if (step_num > 0) { auto trans_it = std::find_if(results.transitions.begin(), results.transitions.end(), [state_id](const TLCRunner::Transition& t) { return t.to_state == state_id; }); if (trans_it != results.transitions.end()) {